Ejemplo n.º 1
0
 def test_release_local_vlan_already_released_network(self):
     net1_port_info = self._form_port_info_dict('fake_vcenter',
                                                'fake_cluster', 'net1')
     with mock.patch('networking_vsphere.db.ovsvapp_db.'
                     'LOG.error') as error_log:
         ovsvapp_db.release_local_vlan(net1_port_info)
         self.assertTrue(error_log.called)
Ejemplo n.º 2
0
 def test_release_local_vlan_already_released_network(self):
     net1_port_info = self._form_port_info_dict(
         'fake_vcenter', 'fake_cluster', 'net1')
     with mock.patch('networking_vsphere.db.ovsvapp_db.'
                     'LOG.error') as error_log:
         ovsvapp_db.release_local_vlan(net1_port_info)
         self.assertTrue(error_log.called)
Ejemplo n.º 3
0
 def update_lvid_assignment(self, rpc_context, **kwargs):
     net_info = kwargs.get('net_info')
     if net_info:
         try:
             ovsvapp_db.release_local_vlan(net_info)
         except Exception:
             LOG.exception(_("Failed to release the local vlan"))
     return
Ejemplo n.º 4
0
 def update_lvid_assignment(self, rpc_context, **kwargs):
     net_info = kwargs.get('net_info')
     if net_info:
         try:
             ovsvapp_db.release_local_vlan(net_info)
         except Exception:
             LOG.exception(_LE("Failed to release the local vlan"))
     return
    def test_release_local_vlan(self):
        net1_port_info = self._form_port_info_dict("fake_vcenter", "fake_cluster", "net1")
        # Allocate network.
        ovsvapp_db.get_local_vlan(net1_port_info)

        # Setup for release.
        lvid = ovsvapp_db.check_to_reclaim_local_vlan(net1_port_info)
        self.assertEqual(1, lvid)
        with mock.patch("networking_vsphere.db.ovsvapp_db." "LOG.error") as error_log:
            ovsvapp_db.release_local_vlan(net1_port_info)
            self.assertFalse(error_log.called)
    def test_get_stale_local_vlans_for_network_no_stale_networks(self):
        net1_port_info = self._form_port_info_dict("fake_vcenter", "fake_cluster", "net1")
        # Allocate network.
        ovsvapp_db.get_local_vlan(net1_port_info)

        # Setup for release.
        lvid = ovsvapp_db.check_to_reclaim_local_vlan(net1_port_info)
        self.assertEqual(1, lvid)
        ovsvapp_db.release_local_vlan(net1_port_info)
        ret_val = ovsvapp_db.get_stale_local_vlans_for_network("net1")
        self.assertIsNone(ret_val)
Ejemplo n.º 7
0
    def test_get_stale_local_vlans_for_network_no_stale_networks(self):
        net1_port_info = self._form_port_info_dict('fake_vcenter',
                                                   'fake_cluster', 'net1')
        # Allocate network.
        ovsvapp_db.get_local_vlan(net1_port_info)

        # Setup for release.
        lvid = ovsvapp_db.check_to_reclaim_local_vlan(net1_port_info)
        self.assertEqual(1, lvid)
        ovsvapp_db.release_local_vlan(net1_port_info)
        ret_val = ovsvapp_db.get_stale_local_vlans_for_network('net1')
        self.assertIsNone(ret_val)
Ejemplo n.º 8
0
    def test_release_local_vlan(self):
        net1_port_info = self._form_port_info_dict('fake_vcenter',
                                                   'fake_cluster', 'net1')
        # Allocate network.
        ovsvapp_db.get_local_vlan(net1_port_info)

        # Setup for release.
        lvid = ovsvapp_db.check_to_reclaim_local_vlan(net1_port_info)
        self.assertEqual(1, lvid)
        with mock.patch('networking_vsphere.db.ovsvapp_db.'
                        'LOG.error') as error_log:
            ovsvapp_db.release_local_vlan(net1_port_info)
            self.assertFalse(error_log.called)