def check_segmentation_compatibility(self): """Fail to load if segmentation type conflicts are found. In multi-driver deployments each loaded driver must support the same set of segmentation types consistently. """ # Get list of segmentation types for the loaded drivers. list_of_driver_seg_types = [ set(driver.segmentation_types) for driver in self._drivers if driver.is_loaded ] # If not empty, check that there is at least one we can use. compat_segmentation_types = set() if list_of_driver_seg_types: compat_segmentation_types = ( set.intersection(*list_of_driver_seg_types)) if not compat_segmentation_types: raise trunk_exc.IncompatibleDriverSegmentationTypes() # If there is at least one, make sure the validator is defined. try: for seg_type in compat_segmentation_types: self.add_segmentation_type( seg_type, validators.get_validator(seg_type)) except KeyError: raise trunk_exc.SegmentationTypeValidatorNotFound( seg_type=seg_type)
def test_get_validator(self): self.assertIsNotNone(validators.get_validator(constants.VLAN))
def test_get_validator(self): self.assertIsNotNone(validators.get_validator( constants.SEGMENTATION_TYPE_VLAN))
def test_get_validator(self): self.assertIsNotNone( validators.get_validator(constants.SEGMENTATION_TYPE_VLAN))
def test_get_validator(self): self.assertIsNotNone(validators.get_validator(constants.VLAN))