Beispiel #1
0
 def delete_port_chain(self, context, id):
     # if this port chain is part of a graph, abort delete:
     if self._any_port_chains_in_a_graph(context, {id}):
         raise ext_sg.ServiceGraphPortChainInUse(id=id)
     try:
         with db_api.context_manager.writer.using(context):
             pc = self._get_port_chain(context, id)
             context.session.delete(pc)
     except ext_sfc.PortChainNotFound:
         LOG.info("Deleting a non-existing port chain.")
Beispiel #2
0
    def update_port_chain(self, context, id, port_chain):
        pc = port_chain['port_chain']
        # if this port chain is part of a graph, abort non-neutral updates:
        if self._any_port_chains_in_a_graph(context, {id}):
            if 'flow_classifiers' in pc or 'port_pair_groups' in pc:
                raise ext_sg.ServiceGraphPortChainInUse(id=id)

        with db_api.context_manager.writer.using(context):
            pc_db = self._get_port_chain(context, id)
            for k, v in pc.items():
                if k == 'flow_classifiers':
                    self._validate_flow_classifiers(context, v, pc_id=id)
                    self._setup_chain_classifier_associations(
                        context, pc_db, v)
                elif k == 'port_pair_groups':
                    self._validate_port_pair_groups(context, v, pc_id=id)
                    self._setup_chain_group_associations(context, pc_db, v)
                else:
                    pc_db[k] = v
            return self._make_port_chain_dict(pc_db)