コード例 #1
0
 def create_bgp_router(self, name, vendor, asn=None):
     ip_fabric_ri = self._vnc_lib.routing_instance_read(
         fq_name=['default-domain', 'default-project', 'ip-fabric', '__default__'])
     router = BgpRouter(name, parent_obj=ip_fabric_ri)
     params = BgpRouterParams()
     params.vendor = 'contrail'
     params.autonomous_system = asn
     router.set_bgp_router_parameters(params)
     self._vnc_lib.bgp_router_create(router)
     return router
コード例 #2
0
 def create_bgp_router(self, name, vendor, asn=None):
     ip_fabric_ri = self._vnc_lib.routing_instance_read(
         fq_name=['default-domain', 'default-project', 'ip-fabric', '__default__'])
     router = BgpRouter(name, parent_obj=ip_fabric_ri)
     params = BgpRouterParams()
     params.vendor = 'contrail'
     params.autonomous_system = asn
     router.set_bgp_router_parameters(params)
     self._vnc_lib.bgp_router_create(router)
     return router
コード例 #3
0
    def create_router(self,
                      name,
                      mgmt_ip,
                      vendor='juniper',
                      product='mx',
                      ignore_pr=False,
                      role=None,
                      cluster_id=0,
                      ignore_bgp=False,
                      fabric=None):
        bgp_router, pr = None, None

        if not ignore_bgp:
            bgp_router = BgpRouter(name,
                                   display_name=name + "-bgp",
                                   parent_obj=self._get_ip_fabric_ri_obj())
            params = BgpRouterParams()
            params.address = mgmt_ip
            params.identifier = mgmt_ip
            params.address_families = AddressFamilies(
                ['route-target', 'inet-vpn', 'e-vpn', 'inet6-vpn'])
            params.autonomous_system = randint(0, 64512)
            params.cluster_id = cluster_id
            bgp_router.set_bgp_router_parameters(params)
            self._vnc_lib.bgp_router_create(bgp_router)
            gevent.sleep(1)

        if not ignore_pr:
            pr = PhysicalRouter(name, display_name=name)
            pr.physical_router_management_ip = mgmt_ip
            pr.physical_router_vendor_name = vendor
            pr.physical_router_product_name = product
            pr.physical_router_vnc_managed = True
            if role:
                pr.physical_router_role = role
            uc = UserCredentials('user', 'pw')
            pr.set_physical_router_user_credentials(uc)
            pr.set_fabric(fabric)
            if not ignore_bgp:
                pr.set_bgp_router(bgp_router)
            self._vnc_lib.physical_router_create(pr)
            gevent.sleep(1)

        return bgp_router, pr
コード例 #4
0
    def create_router(self, name, mgmt_ip, vendor='juniper', product='mx',
                      ignore_pr=False, role=None, cluster_id=0,
                      ignore_bgp=False, fabric=None):
        bgp_router, pr = None, None

        if not ignore_bgp:
            bgp_router = BgpRouter(name,
                                   display_name=name+"-bgp",
                                   parent_obj=self._get_ip_fabric_ri_obj())
            params = BgpRouterParams()
            params.address = mgmt_ip
            params.identifier = mgmt_ip
            params.address_families = AddressFamilies(['route-target', 'inet-vpn',
                                                       'e-vpn', 'inet6-vpn'])
            params.autonomous_system = randint(0, 64512)
            params.cluster_id = cluster_id
            bgp_router.set_bgp_router_parameters(params)
            self._vnc_lib.bgp_router_create(bgp_router)
            gevent.sleep(1)

        if not ignore_pr:
            pr = PhysicalRouter(name, display_name=name)
            pr.physical_router_management_ip = mgmt_ip
            pr.physical_router_vendor_name = vendor
            pr.physical_router_product_name = product
            pr.physical_router_vnc_managed = True
            if role:
                pr.physical_router_role = role
            uc = UserCredentials('user', 'pw')
            pr.set_physical_router_user_credentials(uc)
            pr.set_fabric(fabric)
            if not ignore_bgp:
                pr.set_bgp_router(bgp_router)
            self._vnc_lib.physical_router_create(pr)
            gevent.sleep(1)

        return bgp_router, pr