def main_function(self):

        # create Bpg Route Outside Network
        self.check_if_tenant_exist()
        l3ext_out = createRoutedOutside.create_routed_outside(self.mo, self.routed_outside['name'], optional_args=self.routed_outside['optional_args'])
        # self.commit_change()

        # create Node-And-Interface Profile
        l3ext_lnodep = createNodesAndInterfacesProfile.create_node_profile(l3ext_out, self.node_profile['name'], optional_args=return_valid_optional_args(self.node_profile))
        # self.commit_change(l3ext_out)

        # create Nodes And Interfaces
        l3ext_rsnodel3outatt = createNodes.create_node(l3ext_lnodep, str(self.leaf_id), str(self.router_id))
        l3ext_lifp = createInterfaceProfile.create_interface_profile(l3ext_lnodep, self.interface_profile['name'])
        # self.commit_change(l3ext_lnodep)

        # create static route
        createStaticRoute.create_static_route(l3ext_rsnodel3outatt, self.static_route['prefix'], optional_args=self.static_route['optional_args'])
        # self.commit_change(l3ext_rsnodel3outatt)

        # create Routed Interface Profile
        createRoutedInterfaceProfile.create_routed_interface_profile(l3ext_lifp, str(self.interface_profile['leaf_id']), str(self.interface_profile['eth_num']), self.interface_profile['ip_address'], optional_args=self.interface_profile['optional_args'])
        # self.commit_change(l3ext_lifp)

        # create External Network
        l3ext_instp = createExternalNetwork.create_external_network(l3ext_out, self.external_network_epg['name'], optional_args=return_valid_optional_args(self.external_network_epg))
        # self.commit_change(l3ext_out)

        # configure provider/consumer for L3 outside network.
        createL3EpgProviderOrConsumerContract.create_L3_epg_provider_or_consumer_contract(l3ext_instp, 'consumed', self.consumer_contract['name'], optional_args=return_valid_optional_args(self.consumer_contract))
Ejemplo n.º 2
0
    def main_function(self):
        # set Autonomous System Number
        bgp_instpol = self.look_up_mo('uni/fabric/bgpInstP-default', '')
        setAutonomousSystemNumber.set_autonomous_system_number(bgp_instpol, self.autonomous_system_number)
        self.commit_change()

        # create Bpg Route Reflector
        bgp_rrp = self.look_up_mo('uni/fabric/bgpInstP-default/rr', '')
        for reflector_id in self.reflector_id:
            createBgpRouteReflector.create_bgp_route_reflector(bgp_rrp, reflector_id)
        self.commit_change()

        # create Pod Policy group
        fabric_funcp = self.look_up_mo('uni/fabric/funcprof/', '')
        createPodPolicyGroup.create_pod_policy_group(fabric_funcp, self.pod_policy_group['name'], optional_args=self.pod_policy_group['optional_args'])
        self.commit_change()

        # select Pod Policy
        bgp_pods = self.look_up_mo('uni/fabric/podprof-default/pods-default-typ-ALL', '')
        selectPodPolicy.select_pod_policy(bgp_pods, self.pod_policy_group['name'])

        # create Bpg Route Outside Network
        self.check_if_tenant_exist()
        l3ext_out = createRoutedOutside.create_routed_outside(self.mo, self.routed_outside['name'], optional_args=self.routed_outside['optional_args'])
        self.commit_change()

        # create Node-And-Interface Profile
        l3ext_lnodep = createNodesAndInterfacesProfile.create_node_profile(l3ext_out, self.node_profile['name'], optional_args=self.node_profile['optional_args'])
        self.commit_change(l3ext_out)

        # create Nodes And Interfaces
        createNodes.create_node(l3ext_lnodep, str(self.leaf_id), str(self.router_id))
        l3ext_lifp = createInterfaceProfile.create_interface_profile(l3ext_lnodep, self.interface_profile['name'])
        self.commit_change(l3ext_lnodep)

        # create Routed Interface Profile
        createRoutedInterfaceProfile.create_routed_interface_profile(l3ext_lifp, str(self.interface_profile['leaf_id']), str(self.interface_profile['eth_num']), self.interface_profile['ip_address'], optional_args=self.interface_profile['optional_args'])
        self.commit_change(l3ext_lifp)

        # create External Network
        l3ext_instp = createExternalNetwork.create_external_network(l3ext_out, self.external_network_epg['name'], optional_args=self.external_network_epg['optional_args'])
        self.commit_change(l3ext_out)

        # configure provider/consumer for L3 outside network.
        createL3EpgProviderOrConsumerContract.create_L3_epg_provider_or_consumer_contract(l3ext_instp, 'provided', self.provider_contract['name'], optional_args=self.provider_contract['optional_args'])
        createL3EpgProviderOrConsumerContract.create_L3_epg_provider_or_consumer_contract(l3ext_instp, 'consumed', self.consumer_contract['name'], optional_args=self.consumer_contract['optional_args'])
        self.commit_change()

        # Set default settings for private network.
        self.check_if_mo_exist('uni/tn-' + self.tenant + '/ctx-', self.private_network['name'], Ctx, description='Private Network')
        setDefaultSettingForPrivateNetwork.set_default_setting_for_private_network(self.mo, optional_args=self.private_network['optional_args'])
        self.commit_change()

        # Associate the L3 Outside Network to a Birdge Domain.
        self.check_if_mo_exist('uni/tn-' + self.tenant + '/BD-', self.bridge_domain, BD, description='Bridge Domain')
        associateL3OutsideNetworkToBD.associate_l3_outside_network_to_bd(self.mo, self.routed_outside['name'])
Ejemplo n.º 3
0
def lab7B(modir, tenant_name):
    """Setup the Pod Policies"""

    routed_outside_name = tenant_name+'-'+ROUTED_OUTSIDE_NETWORK

    # Create Routed Outside
    create_routed_outside(modir, tenant_name, routed_outside_name, OSPF=True, tnFvCtxName=tenant_name+'_'+PRIVATE_NETWROK)
    # Create Node Profile
    create_node_profile(modir, tenant_name, routed_outside_name, NODE_PROFILE_NAME,)
    # Select Node
    create_node(modir, tenant_name, routed_outside_name, NODE_PROFILE_NAME, LEAF_ID, ROUTED_ID)
    # Create OSPF Interface Profile
    create_interface_profile(modir, tenant_name, routed_outside_name, NODE_PROFILE_NAME, INTERFACE_NAME)
    # Create Routed_Interface
    create_routed_interface_profile(modir, tenant_name, routed_outside_name, NODE_PROFILE_NAME, INTERFACE_NAME, LEAF_ID, ETH, IP_ADDRESS, mtu=MTU)
    # Create External EPG Network
    create_external_network(modir, tenant_name, routed_outside_name, EXTERNAL_NETWORK_NAME, subnet_ip=SUBNET_ID)
Ejemplo n.º 4
0
def lab7B(modir, tenant_name):
    """Setup the Pod Policies"""

    routed_outside_name = tenant_name + '-' + ROUTED_OUTSIDE_NETWORK

    # Create Routed Outside
    create_routed_outside(modir,
                          tenant_name,
                          routed_outside_name,
                          OSPF=True,
                          tnFvCtxName=tenant_name + '_' + PRIVATE_NETWROK)
    # Create Node Profile
    create_node_profile(
        modir,
        tenant_name,
        routed_outside_name,
        NODE_PROFILE_NAME,
    )
    # Select Node
    create_node(modir, tenant_name, routed_outside_name, NODE_PROFILE_NAME,
                LEAF_ID, ROUTED_ID)
    # Create OSPF Interface Profile
    create_interface_profile(modir, tenant_name, routed_outside_name,
                             NODE_PROFILE_NAME, INTERFACE_NAME)
    # Create Routed_Interface
    create_routed_interface_profile(modir,
                                    tenant_name,
                                    routed_outside_name,
                                    NODE_PROFILE_NAME,
                                    INTERFACE_NAME,
                                    LEAF_ID,
                                    ETH,
                                    IP_ADDRESS,
                                    mtu=MTU)
    # Create External EPG Network
    create_external_network(modir,
                            tenant_name,
                            routed_outside_name,
                            EXTERNAL_NETWORK_NAME,
                            subnet_ip=SUBNET_ID)
Ejemplo n.º 5
0
        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()
    routed_outside_optional_args = createRoutedOutside.input_optional_args()
    node_profile_name = createNodesAndInterfacesProfile.input_key_args()
    node_profile_optional_args = createNodesAndInterfacesProfile.input_optional_args()
    nodes_array = add_mos(createNodes.input_key_args, 'Create a Node')
    interface_name = createInterfaceProfile.input_key_args()
    routed_interface_array = add_mos_with_options(createRoutedInterfaceProfile.input_key_args, createRoutedInterfaceProfile.input_optional_args, 'Add a Routed Interface')
    external_network = createExternalNetwork.input_key_args()
    external_network_optional_args = createExternalNetwork.input_optional_args()

    # Running
    createRoutedOutside.create_routed_outside(modir, tenant_name, routed_outside_name, args_from_CLI=routed_outside_optional_args)
    createNodesAndInterfacesProfile.create_node_profile(modir, tenant_name, routed_outside_name, node_profile_name, args_from_CLI=node_profile_optional_args)
    for node in nodes_array:
        createNodes.create_node(modir, tenant_name, routed_outside_name, node_profile_name, node[0], node[1])
    createInterfaceProfile.create_interface_profile(modir, tenant_name, routed_outside_name, node_profile_name, interface_name)
    for routed_interface in routed_interface_array:
        createRoutedInterfaceProfile.create_routed_interface_profile(modir, tenant_name, routed_outside_name, node_profile_name, interface_name, routed_interface[0][0], routed_interface[0][1], routed_interface[0][2], args_from_CLI=routed_interface[1])
    createExternalNetwork.create_external_network(modir, tenant_name, routed_outside_name, external_network, args_from_CLI=external_network_optional_args)



Ejemplo n.º 6
0
    def main_function(self):
        # set Autonomous System Number
        bgp_instpol = self.look_up_mo('uni/fabric/bgpInstP-default', '')
        setAutonomousSystemNumber.set_autonomous_system_number(
            bgp_instpol, self.autonomous_system_number)
        self.commit_change()

        # create Bpg Route Reflector
        bgp_rrp = self.look_up_mo('uni/fabric/bgpInstP-default/rr', '')
        for reflector_id in self.reflector_id:
            createBgpRouteReflector.create_bgp_route_reflector(
                bgp_rrp, reflector_id)
        self.commit_change()

        # create Pod Policy group
        fabric_funcp = self.look_up_mo('uni/fabric/funcprof/', '')
        createPodPolicyGroup.create_pod_policy_group(
            fabric_funcp,
            self.pod_policy_group['name'],
            optional_args=self.pod_policy_group['optional_args'])
        self.commit_change()

        # select Pod Policy
        bgp_pods = self.look_up_mo(
            'uni/fabric/podprof-default/pods-default-typ-ALL', '')
        selectPodPolicy.select_pod_policy(bgp_pods,
                                          self.pod_policy_group['name'])

        # create Bpg Route Outside Network
        self.check_if_tenant_exist()
        l3ext_out = createRoutedOutside.create_routed_outside(
            self.mo,
            self.routed_outside['name'],
            optional_args=self.routed_outside['optional_args'])
        self.commit_change()

        # create Node-And-Interface Profile
        l3ext_lnodep = createNodesAndInterfacesProfile.create_node_profile(
            l3ext_out,
            self.node_profile['name'],
            optional_args=self.node_profile['optional_args'])
        self.commit_change(l3ext_out)

        # create Nodes And Interfaces
        createNodes.create_node(l3ext_lnodep, str(self.leaf_id),
                                str(self.router_id))
        l3ext_lifp = createInterfaceProfile.create_interface_profile(
            l3ext_lnodep, self.interface_profile['name'])
        self.commit_change(l3ext_lnodep)

        # create Routed Interface Profile
        createRoutedInterfaceProfile.create_routed_interface_profile(
            l3ext_lifp,
            str(self.interface_profile['leaf_id']),
            str(self.interface_profile['eth_num']),
            self.interface_profile['ip_address'],
            optional_args=self.interface_profile['optional_args'])
        self.commit_change(l3ext_lifp)

        # create External Network
        l3ext_instp = createExternalNetwork.create_external_network(
            l3ext_out,
            self.external_network_epg['name'],
            optional_args=self.external_network_epg['optional_args'])
        self.commit_change(l3ext_out)

        # configure provider/consumer for L3 outside network.
        createL3EpgProviderOrConsumerContract.create_L3_epg_provider_or_consumer_contract(
            l3ext_instp,
            'provided',
            self.provider_contract['name'],
            optional_args=self.provider_contract['optional_args'])
        createL3EpgProviderOrConsumerContract.create_L3_epg_provider_or_consumer_contract(
            l3ext_instp,
            'consumed',
            self.consumer_contract['name'],
            optional_args=self.consumer_contract['optional_args'])
        self.commit_change()

        # Set default settings for private network.
        self.check_if_mo_exist('uni/tn-' + self.tenant + '/ctx-',
                               self.private_network['name'],
                               Ctx,
                               description='Private Network')
        setDefaultSettingForPrivateNetwork.set_default_setting_for_private_network(
            self.mo, optional_args=self.private_network['optional_args'])
        self.commit_change()

        # Associate the L3 Outside Network to a Birdge Domain.
        self.check_if_mo_exist('uni/tn-' + self.tenant + '/BD-',
                               self.bridge_domain,
                               BD,
                               description='Bridge Domain')
        associateL3OutsideNetworkToBD.associate_l3_outside_network_to_bd(
            self.mo, self.routed_outside['name'])
Ejemplo n.º 7
0
    createNodesAndInterfacesProfile.create_node_profile(
        modir,
        tenant_name,
        routed_outside_name,
        node_profile_name,
        args_from_CLI=node_profile_optional_args)
    for node in nodes_array:
        createNodes.create_node(modir, tenant_name, routed_outside_name,
                                node_profile_name, node[0], node[1])
    createInterfaceProfile.create_interface_profile(modir, tenant_name,
                                                    routed_outside_name,
                                                    node_profile_name,
                                                    interface_name)
    for routed_interface in routed_interface_array:
        createRoutedInterfaceProfile.create_routed_interface_profile(
            modir,
            tenant_name,
            routed_outside_name,
            node_profile_name,
            interface_name,
            routed_interface[0][0],
            routed_interface[0][1],
            routed_interface[0][2],
            args_from_CLI=routed_interface[1])
    createExternalNetwork.create_external_network(
        modir,
        tenant_name,
        routed_outside_name,
        external_network,
        args_from_CLI=external_network_optional_args)
Ejemplo n.º 8
0
                        tenant,
                        routed_outside,
                        node_profile,
                        targetDscp=node_profile_dscp)

    # Select Node
    create_node(modir, tenant, routed_outside, node_profile, leaf_id,
                router_id)

    # Create OSPF Interface Profile
    create_interface_profile(modir, tenant, routed_outside, node_profile,
                             interface)

    # Create Routed_Interface
    create_routed_interface_profile(modir,
                                    tenant,
                                    routed_outside,
                                    node_profile,
                                    interface,
                                    leaf_id,
                                    eth_number,
                                    ip_address,
                                    args_from_CLI=interface_opt_args)

    # Create External EPG Network
    create_external_network(modir,
                            tenant,
                            routed_outside,
                            externmal_network_egp,
                            args_from_CLI=externmal_network_egp_opt_args)
Ejemplo n.º 9
0
        externmal_network_egp_opt_args['subnet_ip'] = \
            data['external_network_epg']['subnet_ip']

    # Create Routed Outside
    create_routed_outside(modir, tenant, routed_outside,
                          args_from_CLI=routed_outside_opt_args)

    # Create Node Profile
    create_node_profile(modir, tenant, routed_outside, node_profile,
                        targetDscp=node_profile_dscp)

    # Select Node
    create_node(modir, tenant, routed_outside, node_profile, leaf_id,
                router_id)

    # Create OSPF Interface Profile
    create_interface_profile(modir, tenant, routed_outside, node_profile,
                             interface)

    # Create Routed_Interface
    create_routed_interface_profile(modir, tenant, routed_outside,
                                    node_profile, interface, leaf_id,
                                    eth_number, ip_address,
                                    args_from_CLI=interface_opt_args)

    # Create External EPG Network
    create_external_network(modir, tenant, routed_outside,
                            externmal_network_egp,
                            args_from_CLI=externmal_network_egp_opt_args)