Example #1
0
    def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id, **kwargs):
        """
        Create a VLAN in the switch, and configure the appropriate interfaces
        for this VLAN
        """
        LOG.debug("NexusPlugin:create_network() called\n")
        self._client.create_vlan(
            vlan_name,
            str(vlan_id),
            self._nexus_ip,
            self._nexus_username,
            self._nexus_password,
            self._nexus_first_port,
            self._nexus_second_port,
            self._nexus_ssh_port,
        )
        nxos_db.add_nexusport_binding(self._nexus_first_port, str(vlan_id))
        nxos_db.add_nexusport_binding(self._nexus_second_port, str(vlan_id))

        new_net_dict = {
            const.NET_ID: net_id,
            const.NET_NAME: net_name,
            const.NET_PORTS: {},
            const.NET_VLAN_NAME: vlan_name,
            const.NET_VLAN_ID: vlan_id,
        }
        self._networks[net_id] = new_net_dict
        return new_net_dict
Example #2
0
 def create_nexusportbinding(self, port_id, vlan_id):
     """create nexus port binding"""
     bind_dict = {}
     try:
         res = nexus_db.add_nexusport_binding(port_id, vlan_id)
         LOG.debug("Created nexus port binding : %s" % res.port_id)
         bind_dict["port-id"] = str(res.port_id)
         bind_dict["vlan-id"] = str(res.vlan_id)
         return bind_dict
     except Exception, exc:
         LOG.error("Failed to create nexus binding: %s" % str(exc))
Example #3
0
    def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
                       **kwargs):
        """
        Create a VLAN in the switch, and configure the appropriate interfaces
        for this VLAN
        """
        LOG.debug("NexusPlugin:create_network() called\n")
        self._client.create_vlan(
            vlan_name, str(vlan_id), self._nexus_ip,
            self._nexus_username, self._nexus_password,
            self._nexus_first_port, self._nexus_second_port,
            self._nexus_ssh_port)
        nxos_db.add_nexusport_binding(self._nexus_first_port, str(vlan_id))
        nxos_db.add_nexusport_binding(self._nexus_second_port, str(vlan_id))

        new_net_dict = {const.NET_ID: net_id,
                        const.NET_NAME: net_name,
                        const.NET_PORTS: {},
                        const.NET_VLAN_NAME: vlan_name,
                        const.NET_VLAN_ID: vlan_id}
        self._networks[net_id] = new_net_dict
        return new_net_dict