Hi;

After 2 hours of searching and being disappointed of vmware website, which is a total mess, I managed to find that all of things are done by APIs on VCSA 6.7. Interestingly there are no enough information about this version despite I found tons of info for previous versions of Vmware vCenter.
Anyway, In this short topic, I’m going to show you how to use some of these APIs to configure basic processes.

First, ensure the SSH is enabled on the vCenter. Actually setup wizard asks you to enable the SSH and if you chose to enable it, then it is time to go to the next step.
To login to the vCenter CLI, you can use SSO credential which is probably has been set during the initial setup by wizard.
After being logged into the CLI, you will face with something like this:

VMware vCenter Server Appliance 6.7.0.20000

Type: vCenter Server with an embedded Platform Services Controller

Last login: Thu Jan  3 11:57:20 2019 from 10.1.100.11
Connected to service

    * List APIs: "help api list"
    * List Plugins: "help pi list"
    * Launch BASH: "shell"

Command> 

As I said, most of the things are done with the help of APIs not classical commands in this mode. To get the list of APIs, use “help api list” command and press Enter:

Command> help api list
Supported API calls by this server:
com.vmware.appliance.health.applmgmt.get
com.vmware.appliance.health.databasestorage.get
com.vmware.appliance.health.load.get
com.vmware.appliance.health.mem.get
com.vmware.appliance.health.softwarepackages.get
com.vmware.appliance.health.storage.get
com.vmware.appliance.health.swap.get
com.vmware.appliance.health.system.get
com.vmware.appliance.health.system.lastcheck
com.vmware.appliance.monitoring.get
com.vmware.appliance.monitoring.list
com.vmware.appliance.monitoring.query
com.vmware.appliance.ntp.get
com.vmware.appliance.ntp.set
com.vmware.appliance.ntp.test
com.vmware.appliance.recovery.backup.job.cancel
com.vmware.appliance.recovery.backup.job.create
com.vmware.appliance.recovery.backup.job.get
com.vmware.appliance.recovery.backup.job.list
com.vmware.appliance.recovery.backup.parts.get
com.vmware.appliance.recovery.backup.parts.list
com.vmware.appliance.recovery.backup.validate
com.vmware.appliance.recovery.restore.job.cancel
com.vmware.appliance.recovery.restore.job.create
com.vmware.appliance.recovery.restore.job.get
com.vmware.appliance.recovery.restore.validate
com.vmware.appliance.system.storage.list
com.vmware.appliance.system.storage.resize
com.vmware.appliance.system.uptime.get
com.vmware.appliance.timesync.get
com.vmware.appliance.timesync.set
com.vmware.appliance.version1.access.consolecli.get
com.vmware.appliance.version1.access.consolecli.set
com.vmware.appliance.version1.access.dcui.get
com.vmware.appliance.version1.access.dcui.set
com.vmware.appliance.version1.access.shell.get
com.vmware.appliance.version1.access.shell.set
com.vmware.appliance.version1.access.ssh.get
com.vmware.appliance.version1.access.ssh.set
com.vmware.appliance.version1.localaccounts.user.add
com.vmware.appliance.version1.localaccounts.user.delete
com.vmware.appliance.version1.localaccounts.user.get
com.vmware.appliance.version1.localaccounts.user.list
com.vmware.appliance.version1.localaccounts.user.password.update
com.vmware.appliance.version1.localaccounts.user.set
com.vmware.appliance.version1.monitoring.snmp.disable
com.vmware.appliance.version1.monitoring.snmp.enable
com.vmware.appliance.version1.monitoring.snmp.get
com.vmware.appliance.version1.monitoring.snmp.hash
com.vmware.appliance.version1.monitoring.snmp.limits
com.vmware.appliance.version1.monitoring.snmp.reset
com.vmware.appliance.version1.monitoring.snmp.set
com.vmware.appliance.version1.monitoring.snmp.stats
com.vmware.appliance.version1.monitoring.snmp.test
com.vmware.appliance.version1.networking.dns.domains.add
com.vmware.appliance.version1.networking.dns.domains.list
com.vmware.appliance.version1.networking.dns.domains.set
com.vmware.appliance.version1.networking.dns.hostname.get
com.vmware.appliance.version1.networking.dns.hostname.set
com.vmware.appliance.version1.networking.dns.hostname.test
com.vmware.appliance.version1.networking.dns.servers.add
com.vmware.appliance.version1.networking.dns.servers.get
com.vmware.appliance.version1.networking.dns.servers.set
com.vmware.appliance.version1.networking.dns.servers.test
com.vmware.appliance.version1.networking.firewall.addr.inbound.add
com.vmware.appliance.version1.networking.firewall.addr.inbound.delete
com.vmware.appliance.version1.networking.firewall.addr.inbound.list
com.vmware.appliance.version1.networking.interfaces.get
com.vmware.appliance.version1.networking.interfaces.list
com.vmware.appliance.version1.networking.ipv4.get
com.vmware.appliance.version1.networking.ipv4.list
com.vmware.appliance.version1.networking.ipv4.renew
com.vmware.appliance.version1.networking.ipv4.set
com.vmware.appliance.version1.networking.ipv6.get
com.vmware.appliance.version1.networking.ipv6.list
com.vmware.appliance.version1.networking.ipv6.set
com.vmware.appliance.version1.networking.routes.add
com.vmware.appliance.version1.networking.routes.delete
com.vmware.appliance.version1.networking.routes.list
com.vmware.appliance.version1.networking.routes.test
com.vmware.appliance.version1.resources.cpu.stats.get
com.vmware.appliance.version1.resources.load.health.get
com.vmware.appliance.version1.resources.load.stats.get
com.vmware.appliance.version1.resources.mem.health.get
com.vmware.appliance.version1.resources.mem.stats.get
com.vmware.appliance.version1.resources.net.stats.get
com.vmware.appliance.version1.resources.net.stats.list
com.vmware.appliance.version1.resources.processes.stats.list
com.vmware.appliance.version1.resources.softwarepackages.health.get
com.vmware.appliance.version1.resources.storage.health.get
com.vmware.appliance.version1.resources.storage.stats.list
com.vmware.appliance.version1.resources.swap.health.get
com.vmware.appliance.version1.resources.swap.stats.get
com.vmware.appliance.version1.resources.system.health.get
com.vmware.appliance.version1.resources.system.stats.get
com.vmware.appliance.version1.services.list
com.vmware.appliance.version1.services.restart
com.vmware.appliance.version1.services.status.get
com.vmware.appliance.version1.services.stop
com.vmware.appliance.version1.system.time.get
com.vmware.appliance.version1.system.update.get
com.vmware.appliance.version1.system.update.set
com.vmware.appliance.version1.system.version.get

Fortunately, the API names are human understandable (Thanks Vmware for being user friendly this time, at least by creating stuffs for humans!!). To get help about any of these APIs, just add “–help” keyword at the end of the API name.

Command> com.vmware.appliance.version1.networking.routes.add --help

Usage:
         com.vmware.appliance.version1.networking.routes.add
         [--help/-h] --interface STR --gateway STR --destination STR
         --prefix INT
Description:
         Set static routing rules. A destination of 0.0.0.0 and
         prefix 0 (for IPv4) or destination of :: and prefix 0 (for
         IPv6) refers to the default gateway.
Input Arguments:
 --interface STR
         Output device interface, for example, "nic0".
 --gateway STR
         Gateway address.
 --destination STR
         Destination address that defines this route.
 --prefix INT
         Destination CIDR prefix that defines this route. See
         http://www.oav.net/mirrors/cidr.html for netmask-to-prefix
         conversion.

In this simple example I want to first get the interface names on the system, then add a permanent static routes.

Getting the interface list on the system:

Command> com.vmware.appliance.version1.networking.interfaces.list
Interfacesinfo: 
  1:
      Status: up
      Mac: 00:0c:29:61:79:7f
      Name: nic0

Adding the static route:

Command> com.vmware.appliance.version1.networking.routes.add --interface nic0 --gateway 10.1.204.1 --destination 10.1.206.0 --prefix 24

Checking the routing table:

Command> com.vmware.appliance.version1.networking.routes.list
Routes: 
  1:
      Interface: nic0
      Prefix: 0
      Destination: 0.0.0.0
      Static: False
      Gateway: 10.1.204.151
  2:
      Interface: nic0
      Prefix: 24
      Destination: 10.1.204.0
      Static: False
      Gateway: 0.0.0.0
  3:
      Interface: nic0
      Prefix: 24
      Destination: 10.1.206.0
      Static: True
      Gateway: 10.1.204.1

I hope with this short topic, I save you lots of time. Really it is interesting to see how a very simple task can be so complex and getting the required information can get frustrating, Thanks to the geek minds on the Vmware developers!
Now, which is 3rd of the January 2019, I wish “simplicity” and “kindness” for the Vmware developers! GUYS! Why do you endeavor to look like mysterious geeks we normally see on the TV? Just think simple dudes. You can add simple fields/sections on the GUI and save your clients lots of time. Why do I need to go to the Shell, get the APIs and edit them to accomplish very basic, tiny and common goal: Adding ONE static route!!? Just think about it!

Happy new year!

Adding static routes to Vmware VCSA 6.7
Tagged on: