def add_router_interface(self, context, router_id, interface_info): """Add a router interface on a subnet. Only invoke the Nexus plugin to create SVI if a Nexus plugin is loaded, otherwise send it to the vswitch plugin """ nexus_driver = cfg.CONF.CISCO.nexus_driver if nexus_driver.endswith('CiscoNEXUSDriver'): LOG.debug(_("Nexus plugin loaded, creating SVI on switch")) if 'subnet_id' not in interface_info: raise cexc.SubnetNotSpecified() if 'port_id' in interface_info: raise cexc.PortIdForNexusSvi() subnet = self.get_subnet(context, interface_info['subnet_id']) gateway_ip = subnet['gateway_ip'] # Get gateway IP address and netmask cidr = subnet['cidr'] netmask = cidr.split('/', 1)[1] gateway_ip = gateway_ip + '/' + netmask network_id = subnet['network_id'] vlan_id = self._get_segmentation_id(network_id) vlan_name = conf.CISCO.vlan_name_prefix + str(vlan_id) n_args = [vlan_name, vlan_id, subnet['id'], gateway_ip, router_id] nexus_output = self._invoke_plugin_per_device( const.NEXUS_PLUGIN, self._func_name(), n_args) return nexus_output else: LOG.debug(_("No Nexus plugin, sending to vswitch")) n_args = [context, router_id, interface_info] ovs_output = self._invoke_plugin_per_device( const.VSWITCH_PLUGIN, self._func_name(), n_args) return ovs_output
def add_router_interface(self, context, router_id, interface_info): """Add a router interface on a subnet. Only invoke the Nexus plugin to create SVI if L3 support on the Nexus switches is enabled and a Nexus plugin is loaded, otherwise send it to the vswitch plugin """ if (conf.CISCO.nexus_l3_enable and self.is_nexus_plugin): LOG.debug(_("L3 enabled on Nexus plugin, create SVI on switch")) if 'subnet_id' not in interface_info: raise cexc.SubnetNotSpecified() if 'port_id' in interface_info: raise cexc.PortIdForNexusSvi() subnet = self.get_subnet(context, interface_info['subnet_id']) gateway_ip = subnet['gateway_ip'] # Get gateway IP address and netmask cidr = subnet['cidr'] netmask = cidr.split('/', 1)[1] gateway_ip = gateway_ip + '/' + netmask network_id = subnet['network_id'] vlan_id = self._get_segmentation_id(network_id) vlan_name = conf.CISCO.vlan_name_prefix + str(vlan_id) n_args = [vlan_name, vlan_id, subnet['id'], gateway_ip, router_id] return self._invoke_plugin_per_device(const.NEXUS_PLUGIN, self._func_name(), n_args) else: LOG.debug(_("L3 disabled or not Nexus plugin, send to vswitch")) n_args = [context, router_id, interface_info] return self._invoke_plugin_per_device(const.VSWITCH_PLUGIN, self._func_name(), n_args)