def nuage_vspk_cli(args): pprint(args) nuage = nuage_vspk_wrapper() nuage.connect() nuage.debug_cli() return 0
def nuage_load_acl_yaml(args): pprint (args) # TRY TO LOAD THE YAML PROVIDED data = yaml.load(args.YAML_FILE) print("") print("####### YAML ACL LOADED: #######") pprint(data) # CHACK PARAMETERS if args.entname is None or args.entname == '': print("you have to specify enterprise name with --entname") return 1 if args.domname is None or args.domname == '': print("you have to specify domain name with --domname") return 1 # CONNECT TO NUAGE nuage = nuage_vspk_wrapper(); nuage.connect() # CREATING NETWORK MACROS for network_macro in data['network_macros']: error_code = nuage.create_network_macro(args.entname[0],network_macro['name'],network_macro['address'],network_macro['mask']) if error_code != 0: print("network_macros creation problem, quiting ...") return 1 # CREATING NETWORK MACRO GROUPS for network_macro_group in data['network_macro_groups']: error_code = nuage.create_empty_network_macro_group(args.entname[0],network_macro_group['name']) if error_code != 0: print("network_macro_group creation problem, quiting ...") return 1 for macro in network_macro_group['macros']: error_code = nuage.add_macro_to_network_macro_group(args.entname[0], network_macro_group['name'], macro['name']) if error_code != 0: print("adding macro to group problem, quiting ...") return 1 return nuage.create_acls(args.entname[0], args.domname[0], data)
def vmware_delete(args): pprint(args) if args.OBJECT is None: print("vmware show didn't recieved mandatory parameter, exiting ....") return if args.OBJECT == 'vm': print("vmware delete vm starting ...") vcenter = vmware_pyvmomi_wrapper() vcenter.connect() if args.name is None or args.name == '': print("You didn't specified name with --name") return 1 vcenter.delete_vm(args.name[0]) if args.OBJECT == 'vms-of-nuage-enterprise': print("vmware delete vms of entire Nuage enterprise starting ...") if args.entname is None or args.entname == '': print("You didn't specified Enterprise name with --entname") return 1 nuage = nuage_vspk_wrapper() nuage.connect() vm_list = nuage.get_VMs_names_for_enterprise(args.entname[0]) if vm_list is None: print( "There are no VMs in this enterprise or enterprise doesn't exist" ) return 1 vcenter = vmware_pyvmomi_wrapper() vcenter.connect() for vm in vm_list: print("Recieved VM name: " + vm) vcenter.delete_vm(vm)
print(" prefix:" + dhcp_option["prefix"] + "/" + dhcp_option["mask"]) print(" prefix:" + dhcp_option["nexthop"]) except Exception, e: print('Caught exception: %s' % str(e)) return 1 print("") print( "Looks like the JSON go loaded completely, will create topology now..." ) nuage = nuage_vspk_wrapper() nuage.connect() nuage.create_enterprise(data['enterprise']) for user in data['users']: nuage.create_user(data['enterprise'], user['username'], user['password'], user['firstname'], user['lastname'], user['useremail']) for group in data['groups']: nuage.create_group(data['enterprise'], group['groupname']) for member in group['members']: nuage.assign_user_to_group(data['enterprise'], group['groupname'], member['username'])
def nuage_assign(args): pprint(args) if args.OBJECT is None: print("nuage assign didn't recieved mandatory parameter, exiting ....") return if args.OBJECT == 'enterprise-to-gateway-vlan': if args.entname is None or args.entname == '': print( "You are assigning without enterprise name?! Specify --entname for object" ) return if args.gateway is None or args.gateway == '': print("You did not specified a gateway with --gateway") return if args.gateway_interface is None or args.gateway_interface == '': print("You did not specified a gateway with --gateway-interface") return if args.vlan_id is None or args.vlan_id == '': print("You did not specified a gateway with --vlan-id") return nuage = nuage_vspk_wrapper() nuage.connect() nuage.assign_permission_vlan_under_gateway_interface( args.entname[0], args.gateway[0], args.gateway_interface[0], args.vlan_id[0]) if args.OBJECT == 'user-to-group': print("assigning user-to-group starting") if args.entname is None or args.entname == '': print( "You are assigning without enterprise any name?! Specify name for object" ) return if args.username is None or args.username == '': print( "You are assigning without username any name?! Specify name for object" ) return if args.groupname is None or args.groupname == '': print( "You are assigning without group any name?! Specify name for object" ) return nuage = nuage_vspk_wrapper() nuage.connect() return nuage.assign_user_to_group(args.entname[0], args.groupname[0], args.username[0]) if args.OBJECT == 'permission-for-group-to-domain': print("assigning permission-for-group-to-domain starting ...") if args.entname is None or args.entname == '': print( "You are assigning without enterprise any name?! Specify name for object" ) return 1 if args.groupname is None or args.groupname == '': print( "You are assigning without group any name?! Specify name for object" ) return 1 if args.domname is None or args.domname == '': print( "You are assigning without domain name any name?! Specify name for object" ) return 1 if args.permission is None or args.permission == '': print( "You are assigning without any permission type specified?! Specify permission type for assignment" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.assign_permission_group_to_domain(args.entname[0], args.groupname[0], args.domname[0], args.permission) if args.OBJECT == 'permission-for-group-to-zone': print("assigning permission-for-group-to-zone starting ...") if args.entname is None or args.entname == '': print( "You are assigning without enterprise any name?! Specify name for object" ) return 1 if args.groupname is None or args.groupname == '': print( "You are assigning without group any name?! Specify name for object" ) return 1 if args.domname is None or args.domname == '': print( "You are assigning without domain name any name?! Specify name for object" ) return 1 if args.zonename is None or args.zonename == '': print( "You are assigning without zone name any name?! Specify name for object" ) return 1 if args.permission is None or args.permission == '': print( "You are assigning without any permission type specified?! Specify permission type for assignment" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.assign_permission_group_to_zone(args.entname[0], args.groupname[0], args.domname[0], args.zonename[0], args.permission)
def nuage_show(args): pprint (args) if args.OBJECT is None: print("nuage show didn't recieved mandatory parameter, exiting ....") return if args.OBJECT == 'users': print("nuage show users starting ...") nuage = nuage_vspk_wrapper() nuage.connect() if (args.filter is not None and len(args.filter) > 0) and (args.entname is not None and len(args.entname) > 0 and args.entname[0] != ''): return nuage.find_user_in_enterprise(args.entname[0],args.filter[0]) elif (args.entname is not None and len(args.entname) > 0 and args.entname[0] != ''): return nuage.print_users_of_enterprise(args.entname[0]) else: return nuage.print_users_of_all_enterprises(); if args.OBJECT == 'groups': print("nuage show groups starting ...") nuage = nuage_vspk_wrapper() nuage.connect() if (args.filter is not None and len(args.filter) > 0) and (args.entname is not None and len(args.entname) > 0 and args.entname[0] != ''): return nuage.find_group_in_enterprise(args.entname[0],args.filter[0]) elif (args.entname is not None and len(args.entname) > 0 and args.entname[0] != ''): return nuage.print_groups_of_enterprise(args.entname[0]) else: nuage.print_groups_of_all_enterprises(); return 0 if args.OBJECT == 'enterprises': print("nuage show enterprises, starting ...") nuage = nuage_vspk_wrapper(); nuage.connect() print ("Printing TREE? : " + str(args.tree)) if len(args.entname) > 0 and args.entname[0] is not None: print ("Filtering by entname: " + str(args.entname[0])) if args.tree == 1 and (args.entname is not None and len(args.entname) > 0 and args.entname[0] != ''): return nuage.print_whole_three(args.entname[0]); elif args.tree == 0 and (args.entname is not None and len(args.entname) > 0 and args.entname[0] != ''): return nuage.print_enterprises(args.entname[0]); else: nuage.print_enterprises(''); return 0; if args.OBJECT == 'domains': print("nuage show domains, starting ...") nuage = nuage_vspk_wrapper(); nuage.connect() if (args.domname is not None and len(args.domname) > 0) and (args.entname is not None and len(args.entname) > 0): return nuage.print_domain_for_enterprise(args.entname[0],args.domname[0]) elif (args.entname is not None and len(args.entname) > 0 and args.entname[0] != ''): return nuage.print_domains_for_enterprise(args.entname[0]) else: return nuage.print_domains(); if args.OBJECT == 'zones': print("nuage show zones, starting ...") nuage = nuage_vspk_wrapper(); nuage.connect() nuage.print_zones(); if args.OBJECT == 'subnets': print("nuage show subnets, starting ...") nuage = nuage_vspk_wrapper(); nuage.connect() nuage.print_subnets(); if args.OBJECT == 'permissions': print("nuage show permissions, starting ...") nuage = nuage_vspk_wrapper(); nuage.connect() if args.entname is None or args.entname == '': nuage.print_permissions_of_all_enterprises(); else: nuage.print_permissions_of_enterprise(args.entname[0]) if args.OBJECT == 'acls': print("nuage show acls, starting ...") if args.entname is None or args.entname == '': print("you have to specify enterprise name with --entname") return if args.domname is None or args.domname == '': print("you have to specify domain name with --domname") return nuage = nuage_vspk_wrapper(); nuage.connect() nuage.print_acls(args.entname[0],args.domname[0]); if args.OBJECT == 'dhcp-options': print("nuage show dhcp-options, starting ...") if args.entname is None or args.entname == '': print("you have to specify enterprise name with --entname") return 1 if args.domname is None or args.domname == '': print("you have to specify domain name with --domname") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() if args.subnetname is not None and args.zonename is not None and len(args.subnetname) > 0 and len(args.zonename) > 0: return nuage.print_dhcp_options_of_subnet(args.entname[0],args.domname[0],args.zonename[0],args.subnetname[0]); else: return nuage.print_dhcp_options_of_domain(args.entname[0],args.domname[0]); if args.OBJECT == 'gateways': print("nuage show gateways starting ...") nuage = nuage_vspk_wrapper() nuage.connect() '''TODO''' nuage.print_gateways()
def connectivity_test(self, name, test_duration, delete_session_at_end, autostart, endpoints, stats_zip, optional_star_centers_array, optional_single_use_stars, optional_stars_unidirectional, optional_traffic_ixia_flow, optional_traffic_ixia_protocol, bSilent): ''' SILENT OR NOT ? ''' self.bSilent = bSilent self.cprint("ENTERING STAR connectivity TEST RUN") session = self.create_session() print("Created SESSION ID: " + str(session.sessionId)) # FLOW NAMES flow_names = [] # Configure few test options testOptions = session.httpGet("config/ixchariot/testOptions") testOptions.testDuration = test_duration testOptions.runtimeErrorsToStopTest = 100 testOptions.consoleManagementQoS = ixchariotApi.getQoSTemplateFromResourcesLibrary( session, "Best Effort") testOptions.endpointManagementQoS = ixchariotApi.getQoSTemplateFromResourcesLibrary( session, "Best Effort") session.httpPut("config/ixchariot/testOptions", data=testOptions) # central nuage = nuage_vspk_wrapper() nuage.connect() for endpoint in endpoints: if endpoint['type'] == "nuage-vm" and endpoint[ 'endpoint-ip'] == "auto": endpoint['endpoint-ip'] = nuage.get_vport_for_enterprise_vm( endpoint['nuage-vm-enterprise'], endpoint['nuage-vm-domain'], endpoint['nuage-vm-zone'], endpoint['nuage-vm-subnet'], endpoint['nuage-vm-name']) if endpoint['endpoint-ip'] is None or endpoint[ 'endpoint-ip'] == 'not-found': print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") print("XXX ERROR! ERROR! ERROR! XXX") print("XXX----------------------------XXX") print("XXX One endpoint generator XXX") print("XXX doesn't have a correct IP! XXX") print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") return 1 iFlowID = 0 used = [] ## HERE WE CREATE THE MESH for endpoint_SRC in endpoints: for endpoint_DST in endpoints: self.cprint("") self.cprint("====================") self.cprint("Evaluating: " + endpoint_SRC['endpoint-ip'] + "-to-" + endpoint_DST['endpoint-ip']) if optional_star_centers_array is not None and endpoint_DST[ 'endpoint-ip'] not in optional_star_centers_array and endpoint_SRC[ 'endpoint-ip'] not in optional_star_centers_array: self.cprint( "Breaking flow as optional-star-center defined, and not matched" ) continue if optional_star_centers_array is not None and endpoint_DST[ 'endpoint-ip'] in optional_star_centers_array and endpoint_SRC[ 'endpoint-ip'] in optional_star_centers_array: self.cprint( "Both endpoints are from the same star center, removing ..." ) continue if endpoint_DST['endpoint-ip'] != endpoint_SRC['endpoint-ip']: # optional_stars_unidirectional == SOURCE, skip if optional_star_centers_array is not None and optional_stars_unidirectional == "source" and endpoint_SRC[ 'endpoint-ip'] not in optional_star_centers_array: self.cprint( endpoint_SRC['endpoint-ip'] + " skipping. Only stars allowed as sources.") continue # optional_stars_unidirectional == SOURCE, skip if optional_star_centers_array is not None and optional_stars_unidirectional == "destination" and endpoint_DST[ 'endpoint-ip'] not in optional_star_centers_array: self.cprint( endpoint_DST['endpoint-ip'] + " skipping. Only stars allowed as destinations.") continue if optional_single_use_stars and optional_single_use_stars == 'yes': #OPTIONAL MAKE EVERY STAR CENTER USED ONLY ONCE if endpoint_DST['endpoint-ip'] in used: self.cprint(endpoint_DST['endpoint-ip'] + " was already used, skipping.") continue if endpoint_SRC['endpoint-ip'] in used: self.cprint(endpoint_SRC['endpoint-ip'] + " was already used, skipping.") continue used.append(endpoint_SRC['endpoint-ip']) used.append(endpoint_DST['endpoint-ip']) #print("=====================================") self.cprint("SRC " + endpoint_SRC['type'] + " ip:" + endpoint_SRC['endpoint-ip'] + "[" + endpoint_SRC["ixia-management-ip"] + "]") self.cprint("DST " + endpoint_DST['type'] + " ip:" + endpoint_DST['endpoint-ip'] + "[" + endpoint_DST["ixia-management-ip"] + "]") if endpoint_SRC[ 'endpoint-ip'] == 'not-found' or endpoint_DST[ 'endpoint-ip'] == 'not-found': print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") print("XXX ERROR! ERROR! ERROR! XXX") print("XXX----------------------------XXX") print("XXX One endpoint generator XXX") print("XXX doesn't have a correct IP! XXX") print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") return 1 ''' CREATION OF FLOW DEFINITION FOR THIS COMBINATION ''' # Create a new FlowGroup iFlowID = iFlowID + 1 name = endpoint_SRC['endpoint-ip'] + "-" + endpoint_DST[ 'endpoint-ip'] flow_names.append(name) self.cprint("FLOWGROUP creation: " + name) direction = "SRC_TO_DEST" topology = "FULL_MESH" flowgroup = ixchariotApi.createFlowGroup( name, direction, topology) session.httpPost("config/ixchariot/flowGroups", data=flowgroup) session.httpPost("config/ixchariot/flowGroups/" + str(iFlowID) + "/network/sourceEndpoints", data=ixchariotApi.createEndpoint( endpoint_SRC['endpoint-ip'], endpoint_SRC["ixia-management-ip"])) session.httpPost("config/ixchariot/flowGroups/" + str(iFlowID) + "/network/destinationEndpoints", data=ixchariotApi.createEndpoint( endpoint_DST['endpoint-ip'], endpoint_DST["ixia-management-ip"])) flowList = [[ optional_traffic_ixia_flow, 1, optional_traffic_ixia_protocol, "None", "None" ]] #flowList = [ # Data flows # ["TCP Baseline Performance", 1, "TCP", "None", "None"] #["UDP Baseline Performance", 1, "UDP", "None", "None"] #["UDP Low Performance", 1, "UDP", "None", "None"] #["TCP Baseline Performance", 1, "TCP", "Best Effort", "Background"] #["UDP Baseline Performance", 3, "UDP", "Background", "None"], # VoIP flows #["G.711a (64 kbps)", 1, "RTP", "Voice", "None"], # Video over RTP flows #["RTP HD (10 Mbps)", 1, "RTP", "Audio Video", "None"], # Adaptive video over HTTP flows #["Netflix Video SD", 1, "TCP", "None", "None"] # ] for i in range(0, len(flowList)): flowData = flowList[i] flowName = flowData[0] users = flowData[1] protocol = flowData[2] sourceQoSName = flowData[3] destinationQoSName = flowData[4] flowScript = ixchariotApi.getFlowScriptFromResourcesLibrary( session, flowName) # TH IS IS NECESSARY TO WORK WITH VTEPS #ixchariotApi.changeFlowScriptParameterValue(flowScript, "MSS", "1410") #ixchariotApi.changeFlowScriptParameterValue(flowScript, "Send Buffer Size", "1300") #ixchariotApi.changeFlowScriptParameterValue(flowScript, "Receive Buffer Size", "1300") # Example for changing the parameter values #if i == 3: # ixchariotApi.changeFlowScriptParameterValue(flowScript, "Bit Rate", "9.8 Mbps") #if i == 4: # ixchariotApi.changeFlowScriptParameterValue(flowScript, "Segment Duration (s)", "3") sourceQoSTemplate = ixchariotApi.getQoSTemplateFromResourcesLibrary( session, sourceQoSName) destinationQoSTemplate = ixchariotApi.getQoSTemplateFromResourcesLibrary( session, destinationQoSName) flow = ixchariotApi.createFlow(flowScript, users, protocol, sourceQoSTemplate, destinationQoSTemplate) session.httpPost("config/ixchariot/flowGroups/" + str(iFlowID) + "/settings/flows", data=flow) if autostart == "yes": self.cprint("") self.cprint("EXECUTING TEST VIA json AUTOSTART=\"yes\"") if stats_zip == "yes": self.run_test(session.sessionId, 1) else: self.run_test(session.sessionId, 0) if delete_session_at_end == "yes": session.stopSession() print("SESSION " + str(session.sessionId) + " DELETION DUE json \"delete-session-at-end\":\"yes\"") session.httpDelete()
def nuage_delete(args): pprint(args) if args.OBJECT is None: print("nuage delete didn't recieved mandatory parameter, exiting ....") return if args.OBJECT == 'vtep': if args.vportname is None or args.vportname == '': print("You did not specified a vportname with --vportname") return if args.entname is None or args.entname == '': print( "You did not specified any parent enterprise name?! Specify --entname " ) return if args.domname is None or args.domname == '': print( "You did not specified any parent domain name?! Specify --domname" ) return if args.zonename is None or args.zonename == '': print( "You did not specified any zone parent name?! Specify --zonename" ) return if args.subnetname is None or args.subnetname == '': print( "You did not specified any subnetname?! Specify --subnetname") return nuage = nuage_vspk_wrapper() nuage.connect() nuage.delete_vtep(args.vportname[0], args.entname[0], args.domname[0], args.zonename[0], args.subnetname[0]) if args.OBJECT == 'enterprise': if args.entname is None or args.entname == '': print( "You are deleting without any name?! Specify name for object") return nuage = nuage_vspk_wrapper() nuage.connect() if args.tree == 1: return nuage.delete_whole_enterprise_tree(args.entname[0]) else: return nuage.delete_enterprise(args.entname[0]) if args.OBJECT == 'user': if args.entname is None or args.entname == '': print( "You are deleting without any enterprise reference?! Specify name for object" ) return 1 if args.username is None or args.username == '': print( "You are deleting without any username reference?! Specify name for object" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_user(args.entname[0], args.username[0]) if args.OBJECT == 'group': if args.entname is None or args.entname == '': print( "You are deleting without any enterprise reference?! Specify name for object" ) return 1 if args.groupname is None or args.groupname == '': print( "You are deleting without any group name reference?! Specify name for object" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_group(args.entname[0], args.groupname[0]) if args.OBJECT == 'domaintemplate': if args.entname is None or args.entname == '': print( "You are deleting without any parent enterprise name?! Specify name for object" ) return 1 if args.domtempname is None or args.domtempname == '': print( "You are deleting without any domain template name?! Specify name for object" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_domain_template(args.entname[0], args.domtempname[0]) if args.OBJECT == 'domain': if args.entname is None or args.entname == '': print( "You are deleting without any parent enterprise name?! Specify name for object" ) return if args.domname is None or args.domname == '': print( "You are deleting without any domain name?! Specify name for object" ) return nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_domain(args.entname[0], args.domname[0]) if args.OBJECT == 'acl': if args.entname is None or args.entname == '': print( "You are deleting without any parent enterprise name?! Specify name for object" ) return 1 if args.domname is None or args.domname == '': print( "You are deleting without any domain name?! Specify name for object" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_acl(args.entname[0], args.domname[0]) if args.OBJECT == 'network_macros': if args.entname is None or args.entname == '': print( "You are deleting without any parent enterprise name?! Specify name for object" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_network_macros(args.entname[0]) if args.OBJECT == 'network_macro_groups': if args.entname is None or args.entname == '': print( "You are deleting without any parent enterprise name?! Specify name for object" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_network_macro_groups(args.entname[0]) if args.OBJECT == 'zone': if args.entname is None or args.entname == '': print( "You are deleting without any parent enterprise name?! Specify name for object" ) return 1 if args.domname is None or args.domname == '': print( "You are deleting without any parent domain name?! Specify name for object" ) return 1 if args.zonename is None or args.zonename == '': print( "You are deleting without any zone name?! Specify name for object" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_zone(args.entname[0], args.domname[0], args.zonename[0]) if args.OBJECT == 'subnet': if args.entname is None or args.entname == '': print( "You are deleting without any parent enterprise name?! Specify name for object" ) return 1 if args.domname is None or args.domname == '': print( "You are deleting without any parent domain name?! Specify name for object" ) return 1 if args.zonename is None or args.zonename == '': print( "You are deleting without any zone parent name?! Specify name for object" ) return 1 if args.subnetname is None or args.subnetname == '': print( "You are deleting subnet without any name?! Specify name for object" ) return 1 nuage = nuage_vspk_wrapper() nuage.connect() return nuage.delete_subnet(args.entname[0], args.domname[0], args.zonename[0], args.subnetname[0]) if args.OBJECT == 'dhcp-options': if args.entname is None or args.entname == '': print( "You are deleting without any parent enterprise name?! Specify name for object" ) return if args.domname is None or args.domname == '': print( "You are deleting without any parent domain name?! Specify name for object" ) return if args.zonename is None or args.zonename == '': print( "You are deleting without any zone parent name?! Specify name for object" ) return if args.subnetname is None or args.subnetname == '': print( "You are deleting subnet without any name?! Specify name for object" ) return nuage = nuage_vspk_wrapper() nuage.connect() nuage.delete_dhcp_options(args.entname[0], args.domname[0], args.zonename[0], args.subnetname[0])
def nuage_create(args): pprint (args) if args.OBJECT is None: print("nuage create didn't recieved mandatory parameter, exiting ....") return if args.OBJECT == 'vlan-on-gateway': if args.gateway is None or args.gateway == '': print("You did not specified a gateway with --gateway") return 1 if args.gateway_interface is None or args.gateway_interface == '': print("You did not specified a gateway with --gateway-interface") return 1 if args.vlan_id is None or args.vlan_id == '': print("You did not specified a gateway with --vlan-id") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() nuage.create_vlan_under_gateway_interface(args.gateway[0],args.gateway_interface[0],args.vlan_id[0]) if args.OBJECT == 'vtep': if args.gateway is None or args.gateway == '': print("You did not specified a gateway with --gateway") return 1 if args.gateway_interface is None or args.gateway_interface == '': print("You did not specified a gateway with --gateway-interface") return 1 if args.vlan_id is None or args.vlan_id == '': print("You did not specified a gateway with --vlan-id") return 1 if args.entname is None or args.entname == '': print("You are creating without any parent enterprise name?! Specify --entname for new object") return 1 if args.domname is None or args.domname == '': print("You are creating without any parent domain name?! Specify --domname for new object") return 1 if args.zonename is None or args.zonename == '': print("You are creating without any zone parent name?! Specify --zonename for new object") return 1 if args.subnetname is None or args.subnetname == '': print("You are creating vtep without any subnet specified?! Specify --subnetname name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() nuage.create_vtep(args.gateway[0], args.entname[0], args.domname[0], args.zonename[0], args.subnetname[0], args.gateway_interface[0], args.vlan_id[0]) if args.OBJECT == 'default-permit-acls': if args.entname is None or args.entname == '': print("You are creating without any name?! Specify name for new object") return 1 if args.domname is None or args.domname == '': print("You are creating without any domain name?! Specify name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_default_permit_acls(args.entname[0],args.domname[0]) if args.OBJECT == 'acl': if args.entname is None or args.entname == '': print("You are creating without any name?! Specify name for new object") return 1 if args.domname is None or args.domname == '': print("You are creating without any domain name?! Specify name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_default_permit_acls(args.entname[0],args.domname[0]) if args.OBJECT == 'enterprise': if args.entname is None or args.entname == '': print("You are creating without any name?! Specify name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_enterprise(args.entname[0]) if args.OBJECT == 'group': if args.entname is None or args.entname == '': print("You are creating without any enterprise name?! Specify name for new object") return 1 if args.groupname is None or args.groupname == '': print("You are creating without any group name ?! Specify name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_group(args.entname[0],args.groupname[0]) if args.OBJECT == 'user': if args.entname is None or args.entname == '': print("You are creating without any parent enterprise name?! Specify enterprise name for new object") return 1 if args.username is None or args.username == '': print("You are creating without any username ?! Specify name for new object") return 1 if args.password is None or args.password == '': print("You are creating without any password ?! Specify enterprise name for new object") return 1 if args.firstname is None or args.firstname == '': print("You are creating without any firstname ?! Specify name for new object") return 1 if args.lastname is None or args.lastname == '': print("You are creating without any lastname?! Specify enterprise name for new object") return 1 if args.useremail is None or args.useremail == '': print("You are creating without any email?! Specify enterprise name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_user(args.entname[0],args.username[0],args.password[0],args.firstname[0],args.lastname[0],args.useremail[0]) if args.OBJECT == 'domaintemplate': if args.entname is None or args.entname == '': print("You are creating without any parent enterprise name?! Specify name for new object") return 1 if args.domtempname is None or args.domtempname == '': print("You are creating without any domain template name?! Specify name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_domain_template(args.entname[0],args.domtempname[0]) if args.OBJECT == 'domain': if args.entname is None or args.entname == '': print("You are creating without any parent enterprise name?! Specify name for new object") return 1 if args.domtempname is None or args.domtempname == '': print("You are creating without any parent domain template name?! Specify name for new object") return 1 if args.domname is None or args.domname == '': print("You are creating without any domain name?! Specify name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_domain(args.entname[0],args.domtempname[0],args.domname[0]) if args.OBJECT == 'zone': if args.entname is None or args.entname == '': print("You are creating without any parent enterprise name?! Specify name for new object") return 1 if args.domname is None or args.domname == '': print("You are creating without any parent domain name?! Specify name for new object") return 1 if args.zonename is None or args.zonename == '': print("You are creating without any zone name?! Specify name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_zone(args.entname[0],args.domname[0],args.zonename[0]) if args.OBJECT == 'subnet': if args.entname is None or args.entname == '': print("You are creating without any parent enterprise name?! Specify name for new object") return 1 if args.domname is None or args.domname == '': print("You are creating without any parent domain name?! Specify name for new object") return 1 if args.zonename is None or args.zonename == '': print("You are creating without any zone parent name?! Specify name for new object") return 1 if args.subnetname is None or args.subnetname == '': print("You are creating subnet without any name?! Specify name for new object") return 1 if args.subnetNetworkIP is None or args.subnetNetworkIP == '': print("You are creating subnet without any Network IP?! Specify name for new object") return 1 if args.subnetNetworkMask is None or args.subnetNetworkMask == '': print("You are creating subnet without any Netwrok Mask?! Specify name for new object") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_subnet(args.entname[0],args.domname[0],args.zonename[0],args.subnetname[0],args.subnetNetworkIP[0],args.subnetNetworkMask[0]) if args.OBJECT == 'dhcp-option-121': if args.entname is None or args.entname == '': print("You are creating without any parent enterprise name?! Specify name for new object") return 1 if args.domname is None or args.domname == '': print("You are creating without any parent domain name?! Specify name for new object") return 1 if args.zonename is None or args.zonename == '': print("You are creating without any zone parent name?! Specify name for new object") return 1 if args.subnetname is None or args.subnetname == '': print("You are creating subnet without any name?! Specify name for new object") return 1 if args.dhcp_route_prefix is None or args.dhcp_route_prefix == '': print("You are creating route prefix ?! Specify name for new object --dhcp-route-prefix") return 1 if args.dhcp_route_nexthop is None or args.dhcp_route_nexthop == '': print("You are creating route without nexthop! Specify name for new object --dhcp-route-nexthop") return 1 if args.dhcp_route_prefix_mask is None or args.dhcp_route_prefix_mask == '': print("You are creating route without prefix mask! Specify name for new object --dhcp-route-prefix-mask") return 1 nuage = nuage_vspk_wrapper(); nuage.connect() return nuage.create_dhcp_option_121(args.entname[0],args.domname[0],args.zonename[0],args.subnetname[0],args.dhcp_route_prefix[0],args.dhcp_route_nexthop[0],args.dhcp_route_prefix_mask[0])