Esempio n. 1
0
    def setup_lrs(self, lrs, vn_fixtures):
        '''Setup Logical routers
        Input LR format:
            LogicalRouter = {
                   'lr1':{'vn_list': ['vn1','vn2'], 'vni': '7001'},
                   'lr2':{'vn_list': ['vn3','vn4'], 'vni': '7002'},
                  }
        '''
        lr_fixtures = {}  # Hash to store Logical router fixtures

        self.logger.info('Creating Logical Routers: %s' % (lrs))
        for each_lr in lrs:
            lr_fix_inputs = {'name': each_lr, 'connections': self.connections}
            vn_uuid_list = []
            for each_vn in lrs[each_lr]['vn_list']:
                vn_uuid_list.append(vn_fixtures[each_vn].uuid)

            self.logger.info('Creating Logical Router: %s  with VN uuids: %s' %
                             (each_lr, vn_uuid_list))
            lr_fix_inputs['connected_networks'] = {'vns': vn_uuid_list}

            if 'vni' in lrs[each_lr]:
                lr_fix_inputs['vni'] = lrs[each_lr]['vni']

            if 'vni' in lrs[each_lr]:
                lr_fix_inputs['vni'] = lrs[each_lr]['vni']

            lr_fixtures[each_lr] = self.useFixture(
                LogicalRouterFixture(**lr_fix_inputs))

        return lr_fixtures
Esempio n. 2
0
 def create_logical_router(self, vn_fixtures, **kwargs):
     vn_ids = [vn.uuid for vn in vn_fixtures]
     self.logger.info('Creating Logical Router with VN uuids: %s'%(vn_ids))
     lr = self.useFixture(LogicalRouterFixture(
         connections=self.connections,
         connected_networks=vn_ids, **kwargs))
     for spine in self.spines:
         lr.add_physical_router(spine.uuid)
     return lr
Esempio n. 3
0
 def create_lr(self, vn_fixtures, vni=None, devices=None, **kwargs):
     vn_ids = [vn.uuid for vn in vn_fixtures]
     vni = vni or str(get_random_vxlan_id(min=10000))
     self.logger.info('Creating Logical Router with VN uuids: %s, VNI %s'%(
         vn_ids, vni))
     lr = self.useFixture(LogicalRouterFixture(
         connections=self.connections,
         connected_networks=vn_ids, vni=vni, vxlan_enabled=True,
         **kwargs))
     return lr
Esempio n. 4
0
 def create_logical_router(self, vn_fixtures, vni=None, devices=None, **kwargs):
     vn_ids = [vn.uuid for vn in vn_fixtures]
     vni = vni or str(get_random_vxlan_id(min=10000))
     self.logger.info('Creating Logical Router with VN uuids: %s, VNI %s'%(
         vn_ids, vni))
     lr = self.useFixture(LogicalRouterFixture(
         connections=self.connections,
         connected_networks=vn_ids, vni=vni, **kwargs))
     for spine in devices or self.spines:
         if kwargs.get('is_public_lr') == True:
             if 'dc_gw' not in self.inputs.get_prouter_rb_roles(spine.name):
                 continue
         lr.add_physical_router(spine.uuid)
     return lr