#NEWLINE# def main( ) : #NEWLINE# #INDENT# parser = argparse . ArgumentParser ( add_help = True , formatter_class = argparse . RawTextHelpFormatter , description = '\n    Define new Uplink Set\n\n    Usage: ' ) #NEWLINE# parser . add_argument ( '-a' , dest = 'host' , required = True , help = '\n    HP OneView Appliance hostname or IP address' ) #NEWLINE# parser . add_argument ( '-u' , dest = 'user' , required = False , default = 'Administrator' , help = '\n    HP OneView Username' ) #NEWLINE# parser . add_argument ( '-p' , dest = 'passwd' , required = True , help = '\n    HP OneView Password' ) #NEWLINE# parser . add_argument ( '-c' , dest = 'cert' , required = False , help = '\n    Trusted SSL Certificate Bundle in PEM (Base64 Encoded DER) Format' ) #NEWLINE# parser . add_argument ( '-y' , dest = 'proxy' , required = False , help = '\n    Proxy (host:port format' ) #NEWLINE# parser . add_argument ( '-j' , dest = 'domain' , required = False , default = 'Local' , help = '\n    HP OneView Authorized Login Domain' ) #NEWLINE# parser . add_argument ( '-n' , dest = 'uplink_set_name' , required = True , help = '\n    Name of the uplink  set' ) #NEWLINE# parser . add_argument ( '-i' , dest = 'logical_interconnect_group_name' , required = True , help = '\n    Name of the associated Logical Interconnect Group' ) #NEWLINE# parser . add_argument ( '-l' , dest = 'list_of_networks' , required = False , nargs = '+' , help = '\n    List of network names to add to the uplink set, encapsulated with quotes\n    and seperated by spaces. For example:\n\n                -l "Net One" "Net Two" "Net Three"' ) #NEWLINE# parser . add_argument ( '-t' , dest = 'uplink_type' , choices = [ 'Ethernet' , 'FibreChannel' ] , required = True , help = '\n    Uplink Type' ) #NEWLINE# parser . add_argument ( '-e' , dest = 'ethernet_type' , choices = [ 'Tagged' , 'Tunnel' , 'Untagged' ] , required = False , default = 'Tagged' , help = '\n    Ethernet Type' ) #NEWLINE# parser . add_argument ( '-x' , dest = 'native_network' , required = False , help = '\n    Name of the network to be marked as native' ) #NEWLINE# parser . add_argument ( '-o' , dest = 'uplink_ports' , required = False , nargs = '+' , help = '\n    List of uplink ports connected to the uplink sets specified as BAY:PORT\n    and seperated by spaces. For example BAY 1 PORT X2 and BAY 1 PORT X3\n    would be specified as:\n                        -o 1:2 1:3' ) #NEWLINE# parser . add_argument ( '-m' , dest = 'lacp_mode' , required = False , choices = [ 'Long' , 'Short' ] , default = 'Long' , help = '\n    LACP mode on ETHERNET uplink ports' ) #NEWLINE# parser . add_argument ( '-g' , dest = 'connection_mode' , choices = [ 'Auto' , 'FailOver' ] , required = False , default = 'Auto' , help = '\n    Ethernet connection mode' ) #NEWLINE# args = parser . parse_args ( ) #NEWLINE# credential = { #NEWLINE# #INDENT# 'authLoginDomain' : args . domain . upper ( ) , #NEWLINE# 'userName' : args . user , #NEWLINE# 'password' : args . passwd , #NEWLINE# #UNINDENT# } #NEWLINE# con = hpov . connection ( args . host ) #NEWLINE# net = hpov . networking ( con ) #NEWLINE# if args . proxy : #NEWLINE# #INDENT# con . set_proxy ( args . proxy . split ( ':' ) [ 0 ] , args . proxy . split ( ':' ) [ 1 ] ) #NEWLINE# #UNINDENT# if args . cert : #NEWLINE# #INDENT# con . set_trusted_ssl_bundle ( args . cert ) #NEWLINE# #UNINDENT# login ( con , credential ) #NEWLINE# acceptEULA ( con ) #NEWLINE# adduplinkset ( con , net , args . uplink_set_name , args . logical_interconnect_group_name , args . list_of_networks , args . uplink_type , args . ethernet_type , args . native_network , args . uplink_ports , args . lacp_mode , args . connection_mode )