예제 #1
0
    def test_nexusportswitchbinding_get(self):
        npb11 = self._npb_test_obj(10, 100)
        npb21 = self._npb_test_obj(20, 100, switch="2.2.2.2")
        npb22 = self._npb_test_obj(20, 200, switch="2.2.2.2")
        self._add_to_db([npb11, npb21, npb22])

        npb = nxdb.get_port_switch_bindings(npb11.port, npb11.switch)
        self.assertEqual(len(npb), 1)
        self._assert_equal(npb[0], npb11)
        npb_all_p20 = nxdb.get_port_switch_bindings(npb21.port, npb21.switch)
        self.assertEqual(len(npb_all_p20), 2)

        npb = nxdb.get_port_switch_bindings(npb21.port, "dummySwitch")
        self.assertIsNone(npb)
예제 #2
0
    def test_nexusportswitchbinding_get(self):
        npb11 = self._npb_test_obj(10, 100)
        npb21 = self._npb_test_obj(20, 100, switch='2.2.2.2')
        npb22 = self._npb_test_obj(20, 200, switch='2.2.2.2')
        self._add_to_db([npb11, npb21, npb22])

        npb = nxdb.get_port_switch_bindings(npb11.port, npb11.switch)
        self.assertEqual(len(npb), 1)
        self._assert_equal(npb[0], npb11)
        npb_all_p20 = nxdb.get_port_switch_bindings(npb21.port, npb21.switch)
        self.assertEqual(len(npb_all_p20), 2)

        npb = nxdb.get_port_switch_bindings(npb21.port, "dummySwitch")
        self.assertIsNone(npb)
 def enable_vlan_on_trunk_int(self, nexus_host, vlanid, interface):
     """Enable a VLAN on a trunk interface."""
     # If one or more VLANs are already configured on this interface,
     # include the 'add' keyword.
     if nexus_db_v2.get_port_switch_bindings(interface, nexus_host):
         snippet = snipp.CMD_INT_VLAN_ADD_SNIPPET
     else:
         snippet = snipp.CMD_INT_VLAN_SNIPPET
     confstr = snippet % (interface, vlanid)
     confstr = self.create_xml_snippet(confstr)
     LOG.debug(_("NexusDriver: %s"), confstr)
     self._edit_config(nexus_host, target='running', config=confstr)
예제 #4
0
 def enable_vlan_on_trunk_int(self, nexus_host, vlanid, interface):
     """Enable a VLAN on a trunk interface."""
     # If one or more VLANs are already configured on this interface,
     # include the 'add' keyword.
     if nexus_db_v2.get_port_switch_bindings(interface, nexus_host):
         snippet = snipp.CMD_INT_VLAN_ADD_SNIPPET
     else:
         snippet = snipp.CMD_INT_VLAN_SNIPPET
     confstr = snippet % (interface, vlanid)
     confstr = self.create_xml_snippet(confstr)
     LOG.debug(_("NexusDriver: %s"), confstr)
     self._edit_config(nexus_host, target='running', config=confstr)
    def enable_vlan_on_trunk_int(self, mgr, nexus_switch, interface, vlanid):
        """Enable vlan in trunk interface.

        Enables trunk mode vlan access an interface on Nexus Switch given
        VLANID.
        """
        # If one or more VLANs are already configured on this interface,
        # include the 'add' keyword.
        if nexus_db_v2.get_port_switch_bindings(interface, nexus_switch):
            snippet = snipp.CMD_INT_VLAN_ADD_SNIPPET
        else:
            snippet = snipp.CMD_INT_VLAN_SNIPPET
        confstr = snippet % (interface, vlanid)
        confstr = self.create_xml_snippet(confstr)
        LOG.debug(_("NexusDriver: %s"), confstr)
        self._edit_config(mgr, target='running', config=confstr)