From 41ac4c4e9a6112d8c98472a1be60e4869814f549 Mon Sep 17 00:00:00 2001 From: Koren Lev Date: Sun, 15 Oct 2017 01:38:44 +0300 Subject: added schemes to support new ui link options + fix api per new schemes Change-Id: I768233f13749d01d436c24c764cb903ca19d3d2a Signed-off-by: Koren Lev --- .../fetchers/cli/cli_fetch_bond_host_pnics.py | 4 ++-- .../fetchers/cli/cli_fetch_vservice_vnics.py | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'app/discover') diff --git a/app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py b/app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py index 77f149f..d988c35 100644 --- a/app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py +++ b/app/discover/fetchers/cli/cli_fetch_bond_host_pnics.py @@ -37,7 +37,7 @@ class CliFetchBondHostPnics(CliAccess): if lines and 'No such file or directory' in lines[0]: return [] # no bonds so directory does not exist bonds = [] - for line in lines: + for line in [l.strip() for l in lines]: bond = self.get_bond_details(host_id, line) if bond: bonds.append(bond) @@ -123,7 +123,7 @@ class CliFetchBondHostPnics(CliAccess): }) if not pnic: self.log.error('unable to find slave pNIC {} under bond {}' - .format(slave_id, interface_id)) + .format(slave['name'], interface_id)) return mac_address = pnic['mac_address'] slave_id = '{}-{}'.format(slave.get('name', ''), mac_address) diff --git a/app/discover/fetchers/cli/cli_fetch_vservice_vnics.py b/app/discover/fetchers/cli/cli_fetch_vservice_vnics.py index 2e074f8..3bc3a5b 100644 --- a/app/discover/fetchers/cli/cli_fetch_vservice_vnics.py +++ b/app/discover/fetchers/cli/cli_fetch_vservice_vnics.py @@ -21,7 +21,7 @@ class CliFetchVserviceVnics(CliAccess): self.regexps = [ {'name': 'mac_address', 're': '^.*\slink/ether\s(\S+)\s'}, {'name': 'IP Address', 're': '^\s*inet ([0-9.]+)/'}, - {'name': 'netmask', 're': '^.*\slink/ether\s[^/]+/(\S+)'}, + {'name': 'netmask', 're': '^\s*inet [0-9.]+/([0-9]+)'}, {'name': 'IPv6 Address', 're': '^\s*inet6 ([^/]+)/.* global '} ] @@ -138,6 +138,8 @@ class CliFetchVserviceVnics(CliAccess): @staticmethod def convert_netmask(cidr): netmask_conversion = { + '32': '255.255.255.255', + '31': '255.255.255.254', '30': '255.255.255.252', '29': '255.255.255.248', '28': '255.255.255.240', @@ -152,7 +154,23 @@ class CliFetchVserviceVnics(CliAccess): '19': '255.255.224.0', '18': '255.255.192.0', '17': '255.255.128.0', - '16': '255.255.0.0' + '16': '255.255.0.0', + '15': '255.254.0.0', + '14': '255.252.0.0', + '13': '255.248.0.0', + '12': '255.240.0.0', + '11': '255.224.0.0', + '10': '255.192.0.0', + '9': '255.128.0.0', + '8': '255.0.0.0', + '7': '254.0.0.0', + '6': '252.0.0.0', + '5': '248.0.0.0', + '4': '240.0.0.0', + '3': '224.0.0.0', + '2': '192.0.0.0', + '1': '128.0.0.0', + '0': '0.0.0.0' } if cidr not in netmask_conversion: raise ValueError('can''t convert to netmask: {}'.format(cidr)) -- cgit 1.2.3-korg