Пример #1
0
    def test_vlan_pool(self):
        vlan_ids = set()
        for x in moves.xrange(VLAN_MIN, VLAN_MAX + 1):
            (physical_network, seg_type,
             vlan_id, m_ip) = n1kv_db_v2.reserve_vlan(self.session, self.net_p)
            self.assertEqual(physical_network, PHYS_NET)
            self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
            self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
            vlan_ids.add(vlan_id)

        self.assertRaises(n_exc.NoNetworkAvailable,
                          n1kv_db_v2.reserve_vlan,
                          self.session,
                          self.net_p)

        n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_ids.pop())
        physical_network, seg_type, vlan_id, m_ip = (n1kv_db_v2.reserve_vlan(
                                                     self.session, self.net_p))
        self.assertEqual(physical_network, PHYS_NET)
        self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
        self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
        vlan_ids.add(vlan_id)

        for vlan_id in vlan_ids:
            n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_id)
Пример #2
0
    def test_vlan_pool(self):
        vlan_ids = set()
        p = _create_test_network_profile_if_not_there(self.session)
        for x in xrange(VLAN_MIN, VLAN_MAX + 1):
            (physical_network, seg_type,
             vlan_id, m_ip) = n1kv_db_v2.reserve_vlan(self.session, p)
            self.assertEqual(physical_network, PHYS_NET)
            self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
            self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
            vlan_ids.add(vlan_id)

        self.assertRaises(q_exc.NoNetworkAvailable,
                          n1kv_db_v2.reserve_vlan,
                          self.session,
                          p)

        n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_ids.pop(),
                                VLAN_RANGES)
        physical_network, seg_type, vlan_id, m_ip = (n1kv_db_v2.reserve_vlan(
                                                     self.session, p))
        self.assertEqual(physical_network, PHYS_NET)
        self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
        self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
        vlan_ids.add(vlan_id)

        for vlan_id in vlan_ids:
            n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_id,
                                    VLAN_RANGES)
Пример #3
0
    def test_vlan_pool(self):
        vlan_ids = set()
        p = _create_test_network_profile_if_not_there(self.session)
        for x in xrange(VLAN_MIN, VLAN_MAX + 1):
            (physical_network, seg_type, vlan_id,
             m_ip) = n1kv_db_v2.reserve_vlan(self.session, p)
            self.assertEqual(physical_network, PHYS_NET)
            self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
            self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
            vlan_ids.add(vlan_id)

        self.assertRaises(q_exc.NoNetworkAvailable, n1kv_db_v2.reserve_vlan,
                          self.session, p)

        n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_ids.pop(),
                                VLAN_RANGES)
        physical_network, seg_type, vlan_id, m_ip = (n1kv_db_v2.reserve_vlan(
            self.session, p))
        self.assertEqual(physical_network, PHYS_NET)
        self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
        self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
        vlan_ids.add(vlan_id)

        for vlan_id in vlan_ids:
            n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_id,
                                    VLAN_RANGES)
    def test_vlan_pool(self):
        vlan_ids = set()
        for x in moves.xrange(VLAN_MIN, VLAN_MAX + 1):
            (physical_network, seg_type,
             vlan_id, m_ip) = n1kv_db_v2.reserve_vlan(self.session, self.net_p)
            self.assertEqual(physical_network, PHYS_NET)
            self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
            self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
            vlan_ids.add(vlan_id)

        self.assertRaises(n_exc.NoNetworkAvailable,
                          n1kv_db_v2.reserve_vlan,
                          self.session,
                          self.net_p)

        n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_ids.pop())
        physical_network, seg_type, vlan_id, m_ip = (n1kv_db_v2.reserve_vlan(
                                                     self.session, self.net_p))
        self.assertEqual(physical_network, PHYS_NET)
        self.assertThat(vlan_id, matchers.GreaterThan(VLAN_MIN - 1))
        self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
        vlan_ids.add(vlan_id)

        for vlan_id in vlan_ids:
            n1kv_db_v2.release_vlan(self.session, PHYS_NET, vlan_id)