def test_delete_mappings_by_bottom_id(self): self._create_pod(0, 'test_az_uuid_0') self._create_pod(1, 'test_az_uuid_1') self._create_pod(2, 'test_az_uuid_2') self._create_resource_mappings() bottom_id = 'bottom_uuid_1' api.delete_mappings_by_bottom_id(self.context, bottom_id) filters = [{'key': 'bottom_id', 'comparator': 'eq', 'value': bottom_id}] routing = core.query_resource( self.context, models.ResourceRouting, filters, []) self.assertEqual(len(routing), 0)
def delete_port_pair(self, context): t_ctx = t_context.get_context_from_neutron_context( context._plugin_context) portpair_id = context.current['id'] mappings = db_api.get_bottom_mappings_by_top_id( t_ctx, portpair_id, t_constants.RT_PORT_PAIR) for b_pod, b_portpair_id in mappings: b_region_name = b_pod['region_name'] b_client = self._get_client(b_region_name) try: b_client.delete_port_pairs(t_ctx, b_portpair_id) except client_exceptions.NotFound: LOG.debug(('port pair: %(portpair_id)s not found, ' 'region name: %(name)s'), {'portpair_id': portpair_id, 'name': b_region_name}) db_api.delete_mappings_by_bottom_id(t_ctx, b_portpair_id)
def delete_flow_classifier(self, context): t_ctx = t_context.get_context_from_neutron_context( context._plugin_context) flowclassifier_id = context.current['id'] mappings = db_api.get_bottom_mappings_by_top_id( t_ctx, flowclassifier_id, t_constants.RT_FLOW_CLASSIFIER) for b_pod, b_classifier_id in mappings: b_region_name = b_pod['region_name'] b_client = self._get_client(b_region_name) try: b_client.delete_flow_classifiers(t_ctx, b_classifier_id) except client_exceptions.NotFound: LOG.debug(('flow classifier: %(classifier_id)s not found, ' 'region name: %(name)s'), {'classifier_id': flowclassifier_id, 'name': b_region_name}) db_api.delete_mappings_by_bottom_id(t_ctx, b_classifier_id)
def delete_flow_classifier(self, context): t_ctx = t_context.get_context_from_neutron_context( context._plugin_context) flowclassifier_id = context.current['id'] mappings = db_api.get_bottom_mappings_by_top_id( t_ctx, flowclassifier_id, t_constants.RT_FLOW_CLASSIFIER) for b_pod, b_classifier_id in mappings: b_region_name = b_pod['region_name'] b_client = self._get_client(b_region_name) try: b_client.delete_flow_classifiers(t_ctx, b_classifier_id) except client_exceptions.NotFound: LOG.debug(('flow classifier: %(classifier_id)s not found, ' 'region name: %(name)s'), { 'classifier_id': flowclassifier_id, 'name': b_region_name }) db_api.delete_mappings_by_bottom_id(t_ctx, b_classifier_id)