NSX|v+v3+p: Allow resetting port binding host
Change-Id: Ic9f3f080bbf51a04cea601b2c4b0614b9b5c4e33
This commit is contained in:
parent
4a749bc35e
commit
392a695bbd
@ -95,6 +95,11 @@ class NsxPortBindingMixin(pbin_db.PortBindingMixin):
|
|||||||
def _process_portbindings_create_and_update(
|
def _process_portbindings_create_and_update(
|
||||||
self, context, port, port_res,
|
self, context, port, port_res,
|
||||||
vif_type=nsx_constants.VIF_TYPE_DVS):
|
vif_type=nsx_constants.VIF_TYPE_DVS):
|
||||||
|
|
||||||
|
# Allow clearing the host id
|
||||||
|
if pbin.HOST_ID in port and port[pbin.HOST_ID] is None:
|
||||||
|
port[pbin.HOST_ID] = ''
|
||||||
|
|
||||||
super(NsxPortBindingMixin,
|
super(NsxPortBindingMixin,
|
||||||
self)._process_portbindings_create_and_update(
|
self)._process_portbindings_create_and_update(
|
||||||
context, port, port_res)
|
context, port, port_res)
|
||||||
|
@ -1929,6 +1929,22 @@ class TestPortsV2(common_v3.NsxV3SubnetMixin,
|
|||||||
def test_requested_subnet_id_v4_and_v6(self):
|
def test_requested_subnet_id_v4_and_v6(self):
|
||||||
return super(TestPortsV2, self).test_requested_subnet_id_v4_and_v6()
|
return super(TestPortsV2, self).test_requested_subnet_id_v4_and_v6()
|
||||||
|
|
||||||
|
def test_port_binding_host(self):
|
||||||
|
with self.port() as port:
|
||||||
|
# add host
|
||||||
|
data = {'port': {portbindings.HOST_ID: 'abc'}}
|
||||||
|
req = self.new_update_request('ports',
|
||||||
|
data, port['port']['id'])
|
||||||
|
res = self.deserialize('json', req.get_response(self.api))
|
||||||
|
self.assertEqual('abc', res['port'][portbindings.HOST_ID])
|
||||||
|
|
||||||
|
# remove host
|
||||||
|
data = {'port': {portbindings.HOST_ID: None}}
|
||||||
|
req = self.new_update_request('ports',
|
||||||
|
data, port['port']['id'])
|
||||||
|
res = self.deserialize('json', req.get_response(self.api))
|
||||||
|
self.assertEqual('', res['port'][portbindings.HOST_ID])
|
||||||
|
|
||||||
|
|
||||||
class DHCPOptsTestCase(test_dhcpopts.TestExtraDhcpOpt,
|
class DHCPOptsTestCase(test_dhcpopts.TestExtraDhcpOpt,
|
||||||
NsxV3PluginTestCaseMixin):
|
NsxV3PluginTestCaseMixin):
|
||||||
|
Loading…
Reference in New Issue
Block a user