def wizard_mode_input_args(self): self.vcenter_provider, self.vcenter_domain = createVcenterDomain.input_key_args( ) self.attachable_entity_profile[ 'name'] = createAttachableAccessEntityprofile.input_key_args() self.attachable_entity_profile[ 'optional_args'] = createAttachableAccessEntityprofile.input_optional_args( ) self.configured_interfaces_pc_vpc[ 'switch_profile'], self.configured_interfaces_pc_vpc[ 'switches'], self.configured_interfaces_pc_vpc[ 'interface_type'], self.configured_interfaces_pc_vpc[ 'interface_ports'], self.configured_interfaces_pc_vpc[ 'interface_selector'], self.configured_interfaces_pc_vpc[ 'interface_policy_group'] = configureInterfacePcAndVpc.input_key_args( ) self.vlan['vlan_name'], self.vlan['vlan_mode'], self.vlan[ 'range_from'], self.vlan[ 'range_to'] = createVlanPool.input_key_args() self.vcenter_credential['profile'], self.vcenter_credential[ 'vmm_user'], self.vcenter_credential[ 'vmm_password'] = createVcenterCredential.input_key_args() self.vcenter_controller['name'], self.vcenter_controller[ 'host_or_ip'], self.vcenter_controller[ 'data_center'] = createVcenterController.input_key_args() self.vcenter_controller[ 'optional_args'] = createVcenterController.input_optional_args()
def wizard_mode_input_args(self): self.input_application_name('') self.vlan, self.vlan_allocation_mode, self.vlan_range_from, self.vlan_range_to = createVlanPool.input_key_args('') self.vmm_provider, self.vmm_domain = createVcenterDomain.input_key_args('') self.vmm_credential_profile, self.vmm_user, self.vmm_password = createVcenterCredential.input_key_args('') self.vcenter_controller, self.host_or_ip, self.data_center = createVcenterController.input_key_args('') self.stats_mode = createVcenterController.input_optional_args(True)['stats_mode'] vmm_domain_associations = add_mos('Add a VMM Domain Association', addVmmDomainAssociation.input_key_args, addVmmDomainAssociation.input_optional_args) for vmm_domain_association in vmm_domain_associations: arg = {'name': vmm_domain_association['key_args'], 'optional_args': vmm_domain_association['opt_args']} self.vmm_domain_associations.append(arg)
def wizard_mode_input_args(self): self.input_application_name('') self.vlan, self.vlan_allocation_mode, self.vlan_range_from, self.vlan_range_to = createVlanPool.input_key_args('') self.vmm_provider, self.vmm_domain = createVmmDomain.input_key_args('') self.vmm_credential_profile, self.vmm_user, self.vmm_password = createVcenterCredential.input_key_args('') self.vcenter_controller, self.host_or_ip, self.data_center = createVcenterController.input_key_args('') self.stats_mode = createVcenterController.input_optional_args(True)['stats_mode'] vmm_domain_associations = add_mos('Add a VMM Domain Association', addVmmDomainAssociation.input_key_args, addVmmDomainAssociation.input_optional_args) for vmm_domain_association in vmm_domain_associations: arg = {'name': vmm_domain_association['key_args'], 'optional_args': vmm_domain_association['opt_args']} self.vmm_domain_associations.append(arg)
def wizard_mode_input_args(self): self.vcenter_provider, self.vcenter_domain = createVcenterDomain.input_key_args( ) self.attachable_entity_profile[ 'name'] = createAttachableAccessEntityprofile.input_key_args() self.attachable_entity_profile[ 'optional_args'] = createAttachableAccessEntityprofile.input_optional_args( ) self.configured_interfaces_pc_vpc[ 'switch_profile'], self.configured_interfaces_pc_vpc[ 'switches'], self.configured_interfaces_pc_vpc[ 'interface_type'], self.configured_interfaces_pc_vpc[ 'interface_ports'], self.configured_interfaces_pc_vpc[ 'interface_selector'], self.configured_interfaces_pc_vpc[ 'interface_policy_group'] = configureInterfacePcAndVpc.input_key_args( ) self.vlan['vlan_name'], self.vlan['vlan_mode'], self.vlan[ 'range_from'], self.vlan[ 'range_to'] = createVlanPool.input_key_args() self.vxlan['vxlan_name'], self.vxlan['range_from'], self.vxlan[ 'range_to'] = createVxlanPool.input_key_args() self.multicast['name'], self.multicast[ 'ip_range_from'], self.multicast[ 'ip_range_to'] = createMulticastAddressBlock.input_key_args() self.vcenter_credentials = read_add_mos_args( add_mos('Add a vCenter Credential', createVcenterCredential.input_key_args)) cdt = [] for credential in self.vcenter_credentials: cdt.append({ 'profile': credential[0], 'vmm_user': credential[1], 'vmm_password': credential[2] }) self.vcenter_credentials = cdt self.vcenter_controller['name'], self.vcenter_controller[ 'host_or_ip'], self.vcenter_controller[ 'data_center'] = createVcenterController.input_key_args() self.vcenter_controller[ 'optional_args'] = createVcenterController.input_optional_args() self.vshield_controller['name'], self.vshield_controller[ 'host_or_ip'] = createVshieldController.input_key_args() self.vshield_controller[ 'optional_args'] = createVshieldController.input_optional_args()
try: host_name, user_name, password, args = set_cli_argparse('Create a vCenter Controller.', key_args) vm_provider = args.pop('provider') vmm_domain_name = args.pop('domain') controller_name = args.pop('controller') except SystemExit: if check_if_requesting_help(sys.argv): sys.exit('Help Page') if len(sys.argv)>1: print 'Invalid input arguments.' host_name, user_name, password = input_login_info() vm_provider, vmm_domain_name = input_vmm_domian_args() controller_name = input_key_args(from_delete_function=True)[0] # Login to APIC modir = apic_login(host_name, user_name, password) # Execute the main function if vm_provider not in ['VMware', 'Microsoft']: print 'VM provider has to be either be \"VMware\" or \"Microsoft\"' else: delete_vcenter_controller(modir, vm_provider, vmm_domain_name, controller_name) modir.logout()
# Login hostname, username, password = input_login_info(msg='') try: modir = apic_login(hostname, username, password) print 'Login succeed.' except KeyError: print 'Login fail.' sys.exit() # Wizard starts asking inputs step by step tenant_name = input_tenant_name() application_name = input_application_name() vlan_pool_array = add_mos(createVlanPool.input_key_args, 'Create a Vlan pool') vmm_domain_provider, vmm_domain_name = createVmmDomain.input_key_args() vmm_domain_options = createVmmDomain.input_optional_args() vcenter_credential_array = add_mos(createVcenterCredential.input_key_args, 'Create a vCenter Domain Credential') vcenter_controller = createVcenterController.input_key_args() vcenter_controller_options = createVcenterController.input_optional_args() vmm_domain_association_array = add_mos_with_options(addVmmDomainAssociation.input_key_args, addVmmDomainAssociation.input_optional_args, 'Add a VMM Domain Association') # Running for vlan_pool in vlan_pool_array: createVlanPool.create_vlan_pool(modir, vlan_pool[0], vlan_pool[1], vlan_pool[2], vlan_pool[3]) createVmmDomain.create_vmm_domain(modir, vmm_domain_provider, vmm_domain_name, args_from_CLI=vmm_domain_options) for vcenter_credential in vcenter_credential_array: createVcenterCredential.create_vcenter_credential(modir, vmm_domain_provider, vmm_domain_name, vcenter_credential[0], vcenter_credential[1], vcenter_credential[2]) createVcenterController.create_vcenter_controller(modir, vmm_domain_provider, vmm_domain_name, vcenter_controller[0], vcenter_controller[1], vcenter_controller[2], args_from_CLI=vcenter_controller_options) for vmm_domain_association in vmm_domain_association_array: addVmmDomainAssociation.add_vmm_domain_association(modir, tenant_name, application_name, vmm_domain_association[0][0], vmm_domain_association[0][1], args_from_CLI=vmm_domain_association[1]) modir.logout()
def wizard_mode_input_args(self): self.vcenter_provider, self.vcenter_domain = createVcenterDomain.input_key_args() self.attachable_entity_profile['name'] = createAttachableAccessEntityprofile.input_key_args() self.attachable_entity_profile['optional_args'] = createAttachableAccessEntityprofile.input_optional_args() self.configured_interfaces_pc_vpc['switch_profile'], self.configured_interfaces_pc_vpc['switches'], self.configured_interfaces_pc_vpc['interface_type'], self.configured_interfaces_pc_vpc['interface_ports'], self.configured_interfaces_pc_vpc['interface_selector'], self.configured_interfaces_pc_vpc['interface_policy_group'] = configureInterfacePcAndVpc.input_key_args() self.vlan['vlan_name'], self.vlan['vlan_mode'], self.vlan['range_from'], self.vlan['range_to'] = createVlanPool.input_key_args() self.vcenter_credential['profile'], self.vcenter_credential['vmm_user'], self.vcenter_credential['vmm_password'] = createVcenterCredential.input_key_args() self.vcenter_controller['name'], self.vcenter_controller['host_or_ip'], self.vcenter_controller['data_center'] = createVcenterController.input_key_args() self.vcenter_controller['optional_args'] = createVcenterController.input_optional_args()
def wizard_mode_input_args(self): self.vcenter_provider, self.vcenter_domain = createVcenterDomain.input_key_args() self.attachable_entity_profile['name'] = createAttachableAccessEntityprofile.input_key_args() self.attachable_entity_profile['optional_args'] = createAttachableAccessEntityprofile.input_optional_args() self.configured_interfaces_pc_vpc['switch_profile'], self.configured_interfaces_pc_vpc['switches'], self.configured_interfaces_pc_vpc['interface_type'], self.configured_interfaces_pc_vpc['interface_ports'], self.configured_interfaces_pc_vpc['interface_selector'], self.configured_interfaces_pc_vpc['interface_policy_group'] = configureInterfacePcAndVpc.input_key_args() self.vlan['vlan_name'], self.vlan['vlan_mode'], self.vlan['range_from'], self.vlan['range_to'] = createVlanPool.input_key_args() self.vxlan['vxlan_name'], self.vxlan['range_from'], self.vxlan['range_to'] = createVxlanPool.input_key_args() self.multicast['name'], self.multicast['ip_range_from'], self.multicast['ip_range_to'] = createMulticastAddressBlock.input_key_args() self.vcenter_credentials = read_add_mos_args(add_mos('Add a vCenter Credential', createVcenterCredential.input_key_args)) cdt = [] for credential in self.vcenter_credentials: cdt.append({'profile': credential[0], 'vmm_user': credential[1], 'vmm_password': credential[2]}) self.vcenter_credentials = cdt self.vcenter_controller['name'], self.vcenter_controller['host_or_ip'], self.vcenter_controller['data_center'] = createVcenterController.input_key_args() self.vcenter_controller['optional_args'] = createVcenterController.input_optional_args() self.vshield_controller['name'], self.vshield_controller['host_or_ip'] = createVshieldController.input_key_args() self.vshield_controller['optional_args'] = createVshieldController.input_optional_args()
try: host_name, user_name, password, args = set_cli_argparse( 'Create a vCenter Controller.', key_args) vm_provider = args.pop('provider') vmm_domain_name = args.pop('domain') controller_name = args.pop('controller') except SystemExit: if check_if_requesting_help(sys.argv): sys.exit('Help Page') if len(sys.argv) > 1: print 'Invalid input arguments.' host_name, user_name, password = input_login_info() vm_provider, vmm_domain_name = input_vmm_domian_args() controller_name = input_key_args(from_delete_function=True)[0] # Login to APIC modir = apic_login(host_name, user_name, password) # Execute the main function if vm_provider not in ['VMware', 'Microsoft']: print 'VM provider has to be either be \"VMware\" or \"Microsoft\"' else: delete_vcenter_controller(modir, vm_provider, vmm_domain_name, controller_name) modir.logout()