Esempio n. 1
0
    def test_get_orphan_vlans(self):
        """Tests the _get_orphan_vlans method."""
        self.adpt.read.side_effect = [self.orphan_vio_resp]
        bridger = net_br.NetworkBridger(self.adpt, self.host_uuid)

        self.assertListEqual([], bridger._get_orphan_vlans(2))
        self.assertListEqual([2018, 2019, 4092], bridger._get_orphan_vlans(0))
        self.assertListEqual([2800, 2801], bridger._get_orphan_vlans(1))
Esempio n. 2
0
    def test_validate_orphan_on_ensure(self):
        """Tests the _validate_orphan_on_ensure method."""
        self.adpt.read.side_effect = [self.orphan_vio_resp]
        bridger = net_br.NetworkBridger(self.adpt, self.host_uuid)

        # Test the Trunk Path - PVID and then an additional
        self.assertRaises(pvm_exc.OrphanVLANFoundOnProvision,
                          bridger._validate_orphan_on_ensure, 4092, 0)
        self.assertRaises(pvm_exc.OrphanVLANFoundOnProvision,
                          bridger._validate_orphan_on_ensure, 2018, 0)

        # Different vSwitch
        self.assertRaises(pvm_exc.OrphanVLANFoundOnProvision,
                          bridger._validate_orphan_on_ensure, 2800, 1)

        # Shouldn't fail on a good vlan
        bridger._validate_orphan_on_ensure(2, 0)
        bridger._validate_orphan_on_ensure(1, 0)
        bridger._validate_orphan_on_ensure(4094, 1)
Esempio n. 3
0
    def test_build_orphan_map(self):
        self.adpt.read.side_effect = [self.orphan_vio_resp]
        bridger = net_br.NetworkBridger(self.adpt, self.host_uuid)
        orphan_map = bridger._build_orphan_map()

        expected_map = {
            0: {
                'nimbus-ch03-p2-vios2': {
                    'ent11': [4092, 2018, 2019]
                }
            },
            1: {
                'nimbus-ch03-p2-vios2': {
                    'ent12': [2800, 2801]
                }
            }
        }

        self.assertEqual(expected_map, orphan_map)
Esempio n. 4
0
 def test_find_new_arbitrary_vid(self):
     nbs = pvm_net.NetBridge.wrap(self.mgr_nbr_resp)
     bridger = net_br.NetworkBridger(self.adpt, self.host_uuid)
     self.assertEqual(4093, bridger._find_new_arbitrary_vid(nbs))
     self.assertEqual(4092,
                      bridger._find_new_arbitrary_vid(nbs, others=[4093]))
Esempio n. 5
0
 def test_is_arbitrary_vid(self):
     nbs = pvm_net.NetBridge.wrap(self.mgr_nbr_resp)
     bridger = net_br.NetworkBridger(self.adpt, self.host_uuid)
     self.assertTrue(bridger._is_arbitrary_vid(4094, nbs))
     self.assertFalse(bridger._is_arbitrary_vid(2227, nbs))