Exemplo n.º 1
0
 def remove_router_interface(self, context, router_id, interface_info):
     port_id = None
     if "port_id" in interface_info:
         port_id = interface_info["port_id"]
     elif "subnet_id" in interface_info:
         subnet_id = interface_info["subnet_id"]
         subnet = utils.retrieve_subnet(context, subnet_id)
         rport_qry = context.session.query(models_v2.Port)
         ports = rport_qry.filter_by(
             device_id=router_id,
             device_owner=l3_constants.DEVICE_OWNER_ROUTER_INTF,
             network_id=subnet["network_id"])
         for p in ports:
             if p["fixed_ips"][0]["subnet_id"] == subnet_id:
                 port_id = p["id"]
                 break
     neutron_router = self._get_router(context, router_id)
     self._l3super.remove_router_interface(self, context, router_id,
                                           interface_info)
     state_change = operation.Operation(self._set_db_router_state,
                                        args=(context, neutron_router,
                                              p_con.Status.UPDATING))
     self._dispatcher.dispatch_l3(d_context=embrane_ctx.DispatcherContext(
         p_con.Events.SHRINK_ROUTER_IF, neutron_router, context,
         state_change),
                                  args=(port_id, ))
Exemplo n.º 2
0
 def remove_router_interface(self, context, router_id, interface_info):
     port_id = None
     if "port_id" in interface_info:
         port_id = interface_info["port_id"]
     elif "subnet_id" in interface_info:
         subnet_id = interface_info["subnet_id"]
         subnet = utils.retrieve_subnet(context, subnet_id)
         rport_qry = context.session.query(models_v2.Port)
         ports = rport_qry.filter_by(
             device_id=router_id,
             device_owner=l3_constants.DEVICE_OWNER_ROUTER_INTF,
             network_id=subnet["network_id"])
         for p in ports:
             if p["fixed_ips"][0]["subnet_id"] == subnet_id:
                 port_id = p["id"]
                 break
     neutron_router = self._get_router(context, router_id)
     self._l3super.remove_router_interface(self, context, router_id,
                                           interface_info)
     state_change = operation.Operation(self._set_db_router_state,
                                        args=(context, neutron_router,
                                              p_con.Status.UPDATING))
     self._dispatcher.dispatch_l3(
         d_context=embrane_ctx.DispatcherContext(
             p_con.Events.SHRINK_ROUTER_IF, neutron_router, context,
             state_change),
         args=(port_id,))
Exemplo n.º 3
0
 def _retrieve_prefix_from_port(self, context, neutron_port):
     subnet_id = neutron_port["fixed_ips"][0]["subnet_id"]
     subnet = utils.retrieve_subnet(context, subnet_id)
     prefix = subnet["cidr"].split("/")[1]
     return prefix
Exemplo n.º 4
0
 def _retrieve_prefix_from_port(self, context, neutron_port):
     subnet_id = neutron_port["fixed_ips"][0]["subnet_id"]
     subnet = utils.retrieve_subnet(context, subnet_id)
     prefix = subnet["cidr"].split("/")[1]
     return prefix