Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl -w
- #
- # Copyright 2006 VMware, Inc. All rights reserved.
- #
- # USAGE:
- #
- # vicfg-vswitch.pl [GENERAL_VIPERL_OPTIONS] [ADDITIONAL_OPTIONS]
- # where acceptable ADDITIONAL_OPTIONS are the following:
- #
- # --list list vswitches and port groups
- # --add <vswitch> add vswitch name
- # --delete <vswitch> delete vswitch
- # --link pnic <vswitch> Sets a pnic as an uplink for the switch
- # --unlink pnic <vswitch> Removes a pnic from the uplinks for the switch
- # --check <vswitch> check if vswitch exists (return 0 if no; 1 if yes)
- # --add-pg <pgname> <vswitch> adds port group
- # --del-pg <pgname> <vswitch> deletes port group
- # --add-pg-uplink pnic --pg <pgname> add an uplink for portgroup
- # --del-pg-uplink pnic --pg <pgname> delete an uplink for portgroup
- # --mtu num <vswitch> sets the mtu of the vswitch
- # --vlan <#> --pg <pgname> <vswitch> Updates vlan id for port group
- # --check-pg --pg <pgname> check if port group exists (return 0 if no; 1 if yes)
- # --check-pg --pg <pgname> <vswitch> check if port group exists on a particular vswitch
- #
- # Example:
- #
- # vicfg-vswitch.pl --add-pg foo vSwitch0
- # vicfg-vswitch.pl --mtu 9000 vSwitch0
- #
- my @options = (
- ['list'], # esxcfg-vswitch --list
- ['add'], # esxcfg-vswitch --add vswitch
- ['delete'], # esxcfg-vswitch --delete vswitch
- ['link', '_default_'], # esxcfg-vswitch --link pnic vswitch
- ['unlink', '_default_'], # esxcfg-vswitch --unlink pnic vswitch
- ['check'], # esxcfg-vswitch --check vswitch
- ['add-pg', '_default_'], # esxcfg-vswitch --add-pg pgname vswitch
- ['del-pg', '_default_'], # esxcfg-vswitch --del-pg pgname vswitch
- ['add-pg-uplink', 'pg', '_default_'], # esxcfg-vswitch --add-pg-uplink pnic pgname vswitch
- ['del-pg-uplink', 'pg', '_default_'], # esxcfg-vswitch --del-pg-uplink pnic pgname vswitch
- ['add-dvp-uplink', 'dvp', '_default_'], # esxcfg-vswitch --add-dvp-uplink pnic dvp dvsname
- ['del-dvp-uplink', 'dvp', '_default_'], # esxcfg-vswitch --del-dvp-uplink pnic dvp dvsname
- ['vlan', 'pg', '_default_'], # esxcfg-vswitch --vlan n --pg name vswitch
- ['check-pg', '_default_'], # esxcfg-vswitch --check-pg pgname vswitch
- ['mtu', '_default_'], # esxcfg-vswitch --mtu num vswitch
- ['get-cdp'], # esxcfg-vswitch --get-cdp vswitch
- ['set-cdp', '_default_'], # esxcfg-vswitch --set-cdp value vswitch
- ['check-pg'] # esxcfg-vswitch --check-pg pgname
- );
- use strict;
- use warnings;
- use Getopt::Long;
- use VMware::VIRuntime;
- use VMware::VILib;
- use VMware::VIExt;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement