Esempio n. 1
0
 def test_gateway_chassis_for_chassis_not_in_chassis_physnets(self):
     # Return True since chassis is not in chassis_physnets
     self.chassis_name = 'host-2'
     self.assertTrue(
         utils.is_gateway_chassis_invalid(self.chassis_name,
                                          self.gw_chassis, self.physnet,
                                          self.chassis_physnets))
Esempio n. 2
0
 def test_gateway_chassis_for_physnet_not_in_chassis_physnets(self):
     # Return True since physnet is not in chassis_physnets
     self.physnet = 'physical-nw-2'
     self.assertTrue(
         utils.is_gateway_chassis_invalid(self.chassis_name,
                                          self.gw_chassis, self.physnet,
                                          self.chassis_physnets))
Esempio n. 3
0
 def test_gateway_chassis_due_to_invalid_chassis_name(self):
     # Return True since chassis is invalid
     self.chassis_name = constants.OVN_GATEWAY_INVALID_CHASSIS
     self.assertTrue(
         utils.is_gateway_chassis_invalid(self.chassis_name,
                                          self.gw_chassis, self.physnet,
                                          self.chassis_physnets))
Esempio n. 4
0
 def test_gateway_chassis_for_chassis_not_in_gw_chassis_list(self):
     # Return True since chassis_name not in gw_chassis
     self.gw_chassis = ['host-2']
     self.assertTrue(
         utils.is_gateway_chassis_invalid(self.chassis_name,
                                          self.gw_chassis, self.physnet,
                                          self.chassis_physnets))
Esempio n. 5
0
 def test_gateway_chassis_for_undefined_physnet(self):
     # Return True since physnet is not defined
     self.chassis_name = 'host-1'
     self.physnet = None
     self.assertTrue(
         utils.is_gateway_chassis_invalid(self.chassis_name,
                                          self.gw_chassis, self.physnet,
                                          self.chassis_physnets))
Esempio n. 6
0
 def test_gateway_chassis_for_gw_chassis_empty(self):
     # Return False if gw_chassis is []
     # This condition states that the chassis is valid, has valid
     # physnets and there are no gw_chassis present in the system.
     self.gw_chassis = []
     self.assertFalse(
         utils.is_gateway_chassis_invalid(self.chassis_name,
                                          self.gw_chassis, self.physnet,
                                          self.chassis_physnets))
Esempio n. 7
0
 def filter_existing_chassis(self, nb_idl, gw_chassis,
                             physnet, chassis_physnets,
                             existing_chassis):
     chassis_list = copy.copy(existing_chassis)
     for chassis_name in existing_chassis:
         if utils.is_gateway_chassis_invalid(chassis_name, gw_chassis,
                                             physnet, chassis_physnets):
             LOG.debug("Chassis %(chassis)s is invalid for scheduling "
                       "router in physnet: %(physnet)s.",
                       {'chassis': chassis_name,
                        'physnet': physnet})
             chassis_list.remove(chassis_name)
     return chassis_list
Esempio n. 8
0
 def get_unhosted_gateways(self, port_physnet_dict, chassis_physnets,
                           gw_chassis):
     unhosted_gateways = []
     for lrp in self._tables['Logical_Router_Port'].rows.values():
         if not lrp.name.startswith('lrp-'):
             continue
         physnet = port_physnet_dict.get(lrp.name[len('lrp-'):])
         chassis_list = self._get_logical_router_port_gateway_chassis(lrp)
         is_max_gw_reached = len(chassis_list) < ovn_const.MAX_GW_CHASSIS
         for chassis_name, prio in chassis_list:
             # TODO(azbiswas): Handle the case when a chassis is no
             # longer valid. This may involve moving conntrack states,
             # so it needs to discussed in the OVN community first.
             if is_max_gw_reached or utils.is_gateway_chassis_invalid(
                     chassis_name, gw_chassis, physnet, chassis_physnets):
                 unhosted_gateways.append(lrp.name)
     return unhosted_gateways
Esempio n. 9
0
 def test_gateway_chassis_valid(self):
     # Return False, since everything is valid
     self.assertFalse(
         utils.is_gateway_chassis_invalid(self.chassis_name,
                                          self.gw_chassis, self.physnet,
                                          self.chassis_physnets))