Skip to content

Commit 966aede

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Add four new network agent types to the list command filter"
2 parents 4b7e32c + 762a3b1 commit 966aede

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

openstackclient/network/v2/network_agent.py

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -164,32 +164,37 @@ def take_action(self, parsed_args):
164164
# OSC minimum requirements include SDK 1.0.
165165
class ListNetworkAgent(command.Lister):
166166
_description = _("List network agents")
167+
_supported_agents = {
168+
'bgp': 'BGP dynamic routing agent',
169+
'dhcp': 'DHCP agent',
170+
'open-vswitch': 'Open vSwitch agent',
171+
'linux-bridge': 'Linux bridge agent',
172+
'ofa': 'OFA driver agent',
173+
'l3': 'L3 agent',
174+
'loadbalancer': 'Loadbalancer agent',
175+
'metering': 'Metering agent',
176+
'metadata': 'Metadata agent',
177+
'macvtap': 'Macvtap agent',
178+
'nic': 'NIC Switch agent',
179+
'baremetal': 'Baremetal Node',
180+
'ovn-controller': 'OVN Controller agent',
181+
'ovn-controller-gateway': 'OVN Controller Gateway agent',
182+
'ovn-metadata': 'OVN Metadata agent',
183+
'ovn-agent': 'OVN Neutron agent',
184+
}
167185

168186
def get_parser(self, prog_name):
169187
parser = super().get_parser(prog_name)
188+
supported_agents = ','.join(self._supported_agents.keys())
170189
parser.add_argument(
171190
'--agent-type',
172191
metavar='<agent-type>',
173-
choices=[
174-
"bgp",
175-
"dhcp",
176-
"open-vswitch",
177-
"linux-bridge",
178-
"ofa",
179-
"l3",
180-
"loadbalancer",
181-
"metering",
182-
"metadata",
183-
"macvtap",
184-
"nic",
185-
"baremetal",
186-
],
192+
choices=list(self._supported_agents.keys()),
187193
help=_(
188194
"List only agents with the specified agent type. "
189-
"The supported agent types are: bgp, dhcp, open-vswitch, "
190-
"linux-bridge, ofa, l3, loadbalancer, metering, "
191-
"metadata, macvtap, nic, baremetal."
192-
),
195+
"The supported agent types are: %(supported_agents)s."
196+
)
197+
% {'supported_agents': supported_agents},
193198
)
194199
parser.add_argument(
195200
'--host',
@@ -237,21 +242,6 @@ def take_action(self, parsed_args):
237242
'Binary',
238243
)
239244

240-
key_value = {
241-
'bgp': 'BGP dynamic routing agent',
242-
'dhcp': 'DHCP agent',
243-
'open-vswitch': 'Open vSwitch agent',
244-
'linux-bridge': 'Linux bridge agent',
245-
'ofa': 'OFA driver agent',
246-
'l3': 'L3 agent',
247-
'loadbalancer': 'Loadbalancer agent',
248-
'metering': 'Metering agent',
249-
'metadata': 'Metadata agent',
250-
'macvtap': 'Macvtap agent',
251-
'nic': 'NIC Switch agent',
252-
'baremetal': 'Baremetal Node',
253-
}
254-
255245
filters = {}
256246

257247
if parsed_args.network is not None:
@@ -269,7 +259,9 @@ def take_action(self, parsed_args):
269259
data = client.routers_hosting_l3_agents(router)
270260
else:
271261
if parsed_args.agent_type is not None:
272-
filters['agent_type'] = key_value[parsed_args.agent_type]
262+
filters['agent_type'] = self._supported_agents[
263+
parsed_args.agent_type
264+
]
273265
if parsed_args.host is not None:
274266
filters['host'] = parsed_args.host
275267

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Added four new network agent types to the list method filter:
5+
``ovn-controller``, ``ovn-controller-gateway``, ``ovn-metadata`` and
6+
``ovn-agent``.

0 commit comments

Comments
 (0)