SDK refactor: Set "is_admin_state_up" for network agent
OpenStackSDK is >=0.9.13 now in requirement, so we can update "is_admin_state_up" as well for the SDK refactor Change-Id: I02de0ebc752ce602032bbe9d73256ed376993e78
This commit is contained in:
parent
1e3dc48c64
commit
f8e8ace88a
@ -186,11 +186,11 @@ class SetNetworkAgent(command.Command):
|
|||||||
attrs = {}
|
attrs = {}
|
||||||
if parsed_args.description is not None:
|
if parsed_args.description is not None:
|
||||||
attrs['description'] = str(parsed_args.description)
|
attrs['description'] = str(parsed_args.description)
|
||||||
# TODO(huanxuan): Also update by the new attribute name
|
|
||||||
# "is_admin_state_up" after sdk 0.9.12
|
|
||||||
if parsed_args.enable:
|
if parsed_args.enable:
|
||||||
|
attrs['is_admin_state_up'] = True
|
||||||
attrs['admin_state_up'] = True
|
attrs['admin_state_up'] = True
|
||||||
if parsed_args.disable:
|
if parsed_args.disable:
|
||||||
|
attrs['is_admin_state_up'] = False
|
||||||
attrs['admin_state_up'] = False
|
attrs['admin_state_up'] = False
|
||||||
client.update_agent(obj, **attrs)
|
client.update_agent(obj, **attrs)
|
||||||
|
|
||||||
|
@ -195,8 +195,6 @@ class TestListNetworkAgent(TestNetworkAgent):
|
|||||||
self.assertEqual(self.data, list(data))
|
self.assertEqual(self.data, list(data))
|
||||||
|
|
||||||
|
|
||||||
# TODO(huanxuan): Also update by the new attribute name
|
|
||||||
# "is_admin_state_up" after sdk 0.9.12
|
|
||||||
class TestSetNetworkAgent(TestNetworkAgent):
|
class TestSetNetworkAgent(TestNetworkAgent):
|
||||||
|
|
||||||
_network_agent = (
|
_network_agent = (
|
||||||
@ -245,6 +243,7 @@ class TestSetNetworkAgent(TestNetworkAgent):
|
|||||||
attrs = {
|
attrs = {
|
||||||
'description': 'new_description',
|
'description': 'new_description',
|
||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
|
'is_admin_state_up': True,
|
||||||
}
|
}
|
||||||
self.network.update_agent.assert_called_once_with(
|
self.network.update_agent.assert_called_once_with(
|
||||||
self._network_agent, **attrs)
|
self._network_agent, **attrs)
|
||||||
@ -266,6 +265,7 @@ class TestSetNetworkAgent(TestNetworkAgent):
|
|||||||
|
|
||||||
attrs = {
|
attrs = {
|
||||||
'admin_state_up': False,
|
'admin_state_up': False,
|
||||||
|
'is_admin_state_up': False,
|
||||||
}
|
}
|
||||||
self.network.update_agent.assert_called_once_with(
|
self.network.update_agent.assert_called_once_with(
|
||||||
self._network_agent, **attrs)
|
self._network_agent, **attrs)
|
||||||
|
Loading…
Reference in New Issue
Block a user