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:
Huanxuan Ao 2017-02-02 11:51:47 +08:00
parent 1e3dc48c64
commit f8e8ace88a
2 changed files with 4 additions and 4 deletions

View File

@ -186,11 +186,11 @@ class SetNetworkAgent(command.Command):
attrs = {}
if parsed_args.description is not None:
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:
attrs['is_admin_state_up'] = True
attrs['admin_state_up'] = True
if parsed_args.disable:
attrs['is_admin_state_up'] = False
attrs['admin_state_up'] = False
client.update_agent(obj, **attrs)

View File

@ -195,8 +195,6 @@ class TestListNetworkAgent(TestNetworkAgent):
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):
_network_agent = (
@ -245,6 +243,7 @@ class TestSetNetworkAgent(TestNetworkAgent):
attrs = {
'description': 'new_description',
'admin_state_up': True,
'is_admin_state_up': True,
}
self.network.update_agent.assert_called_once_with(
self._network_agent, **attrs)
@ -266,6 +265,7 @@ class TestSetNetworkAgent(TestNetworkAgent):
attrs = {
'admin_state_up': False,
'is_admin_state_up': False,
}
self.network.update_agent.assert_called_once_with(
self._network_agent, **attrs)