def wizard_mode_input_args(self): self.autonomous_system_number = setAutonomousSystemNumber.input_key_args('') reflector_ids = add_mos('Add a Bgp Router Reflector', createBgpRouteReflector.input_key_args) for reflector_id in reflector_ids: self.reflector_id.append(reflector_id['key_args']) pod_policy_group = add_mos('Create a Pod Policy Group', createPodPolicyGroup.input_key_args, createPodPolicyGroup.input_optional_args, do_first=True, once=True) self.pod_policy_group['name'] = pod_policy_group['key_args'] self.pod_policy_group['optional_args'] = pod_policy_group['opt_args'] self.routed_outside['name'] = createRoutedOutside.input_key_args('') self.routed_outside['optional_args'] = createRoutedOutside.input_optional_args() self.node_profile['name'] = createNodesAndInterfacesProfile.input_key_args('') self.node_profile['optional_args'] = createNodesAndInterfacesProfile.input_optional_args() self.leaf_id, self.router_id = createNodes.input_key_args('') self.interface_profile['name'] = createInterfaceProfile.input_key_args('') self.interface_profile['leaf_id'], self.interface_profile['eth_num'], self.interface_profile['ip_address'] = createRoutedInterfaceProfile.input_key_args('') self.interface_profile['optional_args'] = createRoutedInterfaceProfile.input_optional_args() self.external_network_epg['name'] = createExternalNetwork.input_key_args('') self.external_network_epg['optional_args'] = createExternalNetwork.input_optional_args() self.provider_contract['name'] = createL3EpgProviderOrConsumerContract.input_key_args(msg='', type_known=True)[0] self.provider_contract['optional_args'] = createL3EpgProviderOrConsumerContract.input_optional_args('provided') self.consumer_contract['name'] = createL3EpgProviderOrConsumerContract.input_key_args(msg='', type_known=True)[0] self.consumer_contract['optional_args'] = createL3EpgProviderOrConsumerContract.input_optional_args('consumed') self.private_network['name'] = setDefaultSettingForPrivateNetwork.input_key_args('') self.private_network['optional_args'] = setDefaultSettingForPrivateNetwork.input_optional_args() self.bridge_domain = associateL3OutsideNetworkToBD.input_key_args('')
def wizard_mode_input_args(self): self.autonomous_system_number = setAutonomousSystemNumber.input_key_args( '') reflector_ids = add_mos('Add a Bgp Router Reflector', createBgpRouteReflector.input_key_args) for reflector_id in reflector_ids: self.reflector_id.append(reflector_id['key_args']) pod_policy_group = add_mos('Create a Pod Policy Group', createPodPolicyGroup.input_key_args, createPodPolicyGroup.input_optional_args, do_first=True, once=True) self.pod_policy_group['name'] = pod_policy_group['key_args'] self.pod_policy_group['optional_args'] = pod_policy_group['opt_args'] self.routed_outside['name'] = createRoutedOutside.input_key_args('') self.routed_outside[ 'optional_args'] = createRoutedOutside.input_optional_args() self.node_profile[ 'name'] = createNodesAndInterfacesProfile.input_key_args('') self.node_profile[ 'optional_args'] = createNodesAndInterfacesProfile.input_optional_args( ) self.leaf_id, self.router_id = createNodes.input_key_args('') self.interface_profile['name'] = createInterfaceProfile.input_key_args( '') self.interface_profile['leaf_id'], self.interface_profile[ 'eth_num'], self.interface_profile[ 'ip_address'] = createRoutedInterfaceProfile.input_key_args('') self.interface_profile[ 'optional_args'] = createRoutedInterfaceProfile.input_optional_args( ) self.external_network_epg[ 'name'] = createExternalNetwork.input_key_args('') self.external_network_epg[ 'optional_args'] = createExternalNetwork.input_optional_args() self.provider_contract[ 'name'] = createL3EpgProviderOrConsumerContract.input_key_args( msg='', type_known=True)[0] self.provider_contract[ 'optional_args'] = createL3EpgProviderOrConsumerContract.input_optional_args( 'provided') self.consumer_contract[ 'name'] = createL3EpgProviderOrConsumerContract.input_key_args( msg='', type_known=True)[0] self.consumer_contract[ 'optional_args'] = createL3EpgProviderOrConsumerContract.input_optional_args( 'consumed') self.private_network[ 'name'] = setDefaultSettingForPrivateNetwork.input_key_args('') self.private_network[ 'optional_args'] = setDefaultSettingForPrivateNetwork.input_optional_args( ) self.bridge_domain = associateL3OutsideNetworkToBD.input_key_args('')
def wizard_mode_input_args(self): self.routed_outside['name'] = createRoutedOutside.input_key_args() self.routed_outside['optional_args'] = createRoutedOutside.input_optional_args() self.node_profile['name'] = createNodesAndInterfacesProfile.input_key_args() self.node_profile['optional_args'] = createNodesAndInterfacesProfile.input_optional_args() self.leaf_id, self.router_id = createNodes.input_key_args() self.static_route['prefix'] = createStaticRoute.input_key_args() self.static_route['optional_args'] = createStaticRoute.input_optional_args() self.interface_profile['name'] = createInterfaceProfile.input_key_args() self.interface_profile['leaf_id'], self.interface_profile['eth_num'], self.interface_profile['ip_address'] = createRoutedInterfaceProfile.input_key_args('') self.interface_profile['optional_args'] = createRoutedInterfaceProfile.input_optional_args() self.external_network_epg['name'] = createExternalNetwork.input_key_args('') self.external_network_epg['optional_args'] = createExternalNetwork.input_optional_args() self.consumer_contract['name'] = createL3EpgProviderOrConsumerContract.input_key_args(msg='', type_known=True)[0] self.consumer_contract['optional_args'] = createL3EpgProviderOrConsumerContract.input_optional_args('consumed')
from utility import * if __name__ == '__main__': # Login hostname, username, password = '******', 'admin', 'Cisco123' #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() routed_outside_name = createRoutedOutside.input_key_args() external_network = createExternalNetwork.input_key_args() provider_contract_name = createL3EpgProviderContract.input_key_args() consumer_contract_name = createL3EpgConsumerContract.input_key_args() private_network = configPrivateNetworkDefaultTimers.input_key_args() private_network_optional_args = configPrivateNetworkDefaultTimers.input_optional_args() bridge_domain = associateL3OutsideNetworkToBD.input_key_args() # Running createL3EpgProviderContract.create_L3_epg_provider_contract(modir, tenant_name, routed_outside_name, external_network, provider_contract_name) createL3EpgConsumerContract.create_L3_epg_consumer_contract(modir, tenant_name, routed_outside_name, external_network, consumer_contract_name) configPrivateNetworkDefaultTimers.config_private_network_default_timers(modir, tenant_name, private_network, args_from_CLI=private_network_optional_args) associateL3OutsideNetworkToBD.associate_l3_outside_network_to_bd(modir, tenant_name, bridge_domain, routed_outside_name)
] try: host_name, user_name, password, args = set_cli_argparse( 'Delete External Network EPG.', key_args) tenant_name = args.pop('tenant') routed_outside_name = args.pop('routed_outside') external_network_name = args.pop('external_network') 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() tenant_name = input_tenant_name() routed_outside_name = input_routed_outside_name() external_network_name = input_key_args() # Login to APIC modir = apic_login(host_name, user_name, password) # Execute the main function delete_external_network(modir, tenant_name, routed_outside_name, external_network_name) modir.logout()
] try: host_name, user_name, password, args = set_cli_argparse('Delete External Network EPG.', key_args) tenant_name = args.pop('tenant') routed_outside_name = args.pop('routed_outside') external_network_name = args.pop('external_network') 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() tenant_name = input_tenant_name() routed_outside_name = input_routed_outside_name() external_network_name = input_key_args() # Login to APIC modir = apic_login(host_name, user_name, password) # Execute the main function delete_external_network(modir, tenant_name, routed_outside_name, external_network_name) modir.logout()