[Admin-Util NSX|V] add more information to backend edges list
'nsxadmin -r edges -o list' and 'nsxadmin -r edges -o list' will now print also the edge name, size and type. output example: +----------+-------------------------------------------+-----------------+---------+ | id | name | type | size | +----------+-------------------------------------------+-----------------+---------+ | edge-315 | rtr1-f7bf9945-af0f-4b56-934d-d2acd4910f9c | gatewayServices | compact | | edge-316 | dhcp-894a2f0d-4220-4 | gatewayServices | compact | | edge-317 | backup-91f975ff-dd46 | gatewayServices | compact | | edge-318 | backup-8c037e6c-84b0 | gatewayServices | compact | +----------+-------------------------------------------+-----------------+---------+ Change-Id: Iab63ecff4b5b3be5ac79a755e534dafbab309666
This commit is contained in:
parent
16bab8947d
commit
cca49245c1
@ -12,7 +12,7 @@ The following resources are supported: 'security-groups', 'edges', 'networks', '
|
|||||||
Edges
|
Edges
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
- NSX list::
|
- List backend NSX edges with their id, name and some more information::
|
||||||
|
|
||||||
nsxadmin -r edges -o nsx-list
|
nsxadmin -r edges -o nsx-list
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ Missing Edges
|
|||||||
Backup Edges
|
Backup Edges
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
- List backup edges::
|
- List backend backup edges with their id, name and some more information::
|
||||||
|
|
||||||
nsxadmin -r backup-edges -o list
|
nsxadmin -r backup-edges -o list
|
||||||
|
|
||||||
|
@ -40,8 +40,7 @@ _uuid = uuidutils.generate_uuid
|
|||||||
|
|
||||||
|
|
||||||
def get_nsxv_backup_edges():
|
def get_nsxv_backup_edges():
|
||||||
edges = nsxv.get_edges()[1]
|
edges = utils.get_nsxv_backend_edges()
|
||||||
edges = edges['edgePage'].get('data', [])
|
|
||||||
backup_edges = []
|
backup_edges = []
|
||||||
edgeapi = utils.NeutronDbClient()
|
edgeapi = utils.NeutronDbClient()
|
||||||
for edge in edges:
|
for edge in edges:
|
||||||
@ -58,7 +57,7 @@ def nsx_list_backup_edges(resource, event, trigger, **kwargs):
|
|||||||
"""List backup edges"""
|
"""List backup edges"""
|
||||||
backup_edges = get_nsxv_backup_edges()
|
backup_edges = get_nsxv_backup_edges()
|
||||||
LOG.info(formatters.output_formatter(constants.BACKUP_EDGES, backup_edges,
|
LOG.info(formatters.output_formatter(constants.BACKUP_EDGES, backup_edges,
|
||||||
['id']))
|
['id', 'name', 'size', 'type']))
|
||||||
|
|
||||||
|
|
||||||
def nsx_clean_backup_edge(resource, event, trigger, **kwargs):
|
def nsx_clean_backup_edge(resource, event, trigger, **kwargs):
|
||||||
@ -108,8 +107,7 @@ def nsx_clean_backup_edge(resource, event, trigger, **kwargs):
|
|||||||
|
|
||||||
@admin_utils.output_header
|
@admin_utils.output_header
|
||||||
def nsx_list_name_mismatches(resource, event, trigger, **kwargs):
|
def nsx_list_name_mismatches(resource, event, trigger, **kwargs):
|
||||||
edges = nsxv.get_edges()[1]
|
edges = utils.get_nsxv_backend_edges()
|
||||||
edges = edges['edgePage'].get('data', [])
|
|
||||||
plugin_nsx_mismatch = []
|
plugin_nsx_mismatch = []
|
||||||
backend_edge_ids = []
|
backend_edge_ids = []
|
||||||
edgeapi = utils.NeutronDbClient()
|
edgeapi = utils.NeutronDbClient()
|
||||||
|
@ -36,17 +36,12 @@ LOG = logging.getLogger(__name__)
|
|||||||
nsxv = utils.get_nsxv_client()
|
nsxv = utils.get_nsxv_client()
|
||||||
|
|
||||||
|
|
||||||
def get_nsxv_edges():
|
|
||||||
edges = nsxv.get_edges()[1]
|
|
||||||
return edges['edgePage'].get('data', [])
|
|
||||||
|
|
||||||
|
|
||||||
@admin_utils.output_header
|
@admin_utils.output_header
|
||||||
def nsx_list_edges(resource, event, trigger, **kwargs):
|
def nsx_list_edges(resource, event, trigger, **kwargs):
|
||||||
"""List edges from NSXv backend"""
|
"""List edges from NSXv backend"""
|
||||||
edges = get_nsxv_edges()
|
edges = utils.get_nsxv_backend_edges()
|
||||||
LOG.info(formatters.output_formatter(constants.EDGES, edges,
|
LOG.info(formatters.output_formatter(constants.EDGES, edges,
|
||||||
['id']))
|
['id', 'name', 'type', 'size']))
|
||||||
|
|
||||||
|
|
||||||
def get_router_edge_bindings():
|
def get_router_edge_bindings():
|
||||||
@ -64,7 +59,7 @@ def neutron_list_router_edge_bindings(resource, event, trigger, **kwargs):
|
|||||||
|
|
||||||
def get_orphaned_edges():
|
def get_orphaned_edges():
|
||||||
nsxv_edge_ids = set()
|
nsxv_edge_ids = set()
|
||||||
for edge in get_nsxv_edges():
|
for edge in utils.get_nsxv_backend_edges():
|
||||||
nsxv_edge_ids.add(edge.get('id'))
|
nsxv_edge_ids.add(edge.get('id'))
|
||||||
|
|
||||||
neutron_edge_bindings = set()
|
neutron_edge_bindings = set()
|
||||||
@ -121,7 +116,7 @@ def nsx_delete_orphaned_edges(resource, event, trigger, **kwargs):
|
|||||||
|
|
||||||
def get_missing_edges():
|
def get_missing_edges():
|
||||||
nsxv_edge_ids = set()
|
nsxv_edge_ids = set()
|
||||||
for edge in get_nsxv_edges():
|
for edge in utils.get_nsxv_backend_edges():
|
||||||
nsxv_edge_ids.add(edge.get('id'))
|
nsxv_edge_ids.add(edge.get('id'))
|
||||||
|
|
||||||
neutron_edge_bindings = set()
|
neutron_edge_bindings = set()
|
||||||
|
@ -48,3 +48,23 @@ class NsxVPluginWrapper(plugin.NsxVPlugin):
|
|||||||
self._extend_network_dict_provider(context, net)
|
self._extend_network_dict_provider(context, net)
|
||||||
# skip getting the Qos policy ID because get_object calls
|
# skip getting the Qos policy ID because get_object calls
|
||||||
# plugin init again on admin-util environment
|
# plugin init again on admin-util environment
|
||||||
|
|
||||||
|
|
||||||
|
def get_nsxv_backend_edges():
|
||||||
|
"""Get a list of all the backend edges and some of their attributes
|
||||||
|
"""
|
||||||
|
nsxv = get_nsxv_client()
|
||||||
|
edges = nsxv.get_edges()[1]
|
||||||
|
edges = edges['edgePage'].get('data', [])
|
||||||
|
backend_edges = []
|
||||||
|
for edge in edges:
|
||||||
|
# get all the relevant backend information for this edge
|
||||||
|
edge_data = {
|
||||||
|
'id': edge.get('id'),
|
||||||
|
'name': edge.get('name'),
|
||||||
|
'size': edge['appliancesSummary'].get(
|
||||||
|
'applianceSize') if edge.get('appliancesSummary') else None,
|
||||||
|
'type': edge.get('edgeType')
|
||||||
|
}
|
||||||
|
backend_edges.append(edge_data)
|
||||||
|
return backend_edges
|
||||||
|
Loading…
x
Reference in New Issue
Block a user