From 421024edcc88f09266a6b3dda4bf4f03663019e2 Mon Sep 17 00:00:00 2001 From: Armingol Date: Thu, 5 Oct 2023 14:56:12 +0200 Subject: [PATCH 1/2] Modification to save the IPv6 address --- .../service/drivers/openconfig/templates/Interfaces.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/device/service/drivers/openconfig/templates/Interfaces.py b/src/device/service/drivers/openconfig/templates/Interfaces.py index 3855db17b..1e45b8996 100644 --- a/src/device/service/drivers/openconfig/templates/Interfaces.py +++ b/src/device/service/drivers/openconfig/templates/Interfaces.py @@ -22,6 +22,7 @@ LOGGER = logging.getLogger(__name__) XPATH_INTERFACES = "//oci:interfaces/oci:interface" XPATH_SUBINTERFACES = ".//oci:subinterfaces/oci:subinterface" XPATH_IPV4ADDRESSES = ".//ociip:ipv4/ociip:addresses/ociip:address" +XPATH_IPV4ADDRESSES = ".//ociip:ipv6/ociip:addresses/ociip:address" def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: response = [] @@ -97,6 +98,15 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: #add_value_from_collection(subinterface, 'ipv4_addresses', ipv4_addresses) + for xml_ipv6_address in xml_subinterface.xpath(XPATH_IPV6ADDRESSES, namespaces=NAMESPACES): + #LOGGER.info('xml_ipv6_address = {:s}'.format(str(ET.tostring(xml_ipv6_address)))) + + address = xml_ipv6_address.find('ociip:state/ociip:ip', namespaces=NAMESPACES) + add_value_from_tag(subinterface, 'address_ipv6', address) + + prefix = xml_ipv6_address.find('ociip:state/ociip:prefix-length', namespaces=NAMESPACES) + add_value_from_tag(subinterface, 'address_prefix_v6', prefix, cast=int) + if len(subinterface) == 0: continue resource_key = '/interface[{:s}]/subinterface[{:s}]'.format(interface['name'], str(subinterface['index'])) response.append((resource_key, subinterface)) -- GitLab From 2739fab6d108a174be9f5e3f5d0a4c6b65778750 Mon Sep 17 00:00:00 2001 From: Armingol Date: Fri, 6 Oct 2023 11:36:23 +0200 Subject: [PATCH 2/2] Bug fixes --- src/compute/requirements.in | 1 + src/device/service/drivers/openconfig/templates/Interfaces.py | 2 +- src/webui/requirements.in | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compute/requirements.in b/src/compute/requirements.in index 08bbf281a..dc22f64eb 100644 --- a/src/compute/requirements.in +++ b/src/compute/requirements.in @@ -17,3 +17,4 @@ Flask-HTTPAuth==4.5.0 Flask-RESTful==0.3.9 jsonschema==4.4.0 requests==2.27.1 +werkzeug==2.3.7 \ No newline at end of file diff --git a/src/device/service/drivers/openconfig/templates/Interfaces.py b/src/device/service/drivers/openconfig/templates/Interfaces.py index 1e45b8996..3d4c73fc1 100644 --- a/src/device/service/drivers/openconfig/templates/Interfaces.py +++ b/src/device/service/drivers/openconfig/templates/Interfaces.py @@ -22,7 +22,7 @@ LOGGER = logging.getLogger(__name__) XPATH_INTERFACES = "//oci:interfaces/oci:interface" XPATH_SUBINTERFACES = ".//oci:subinterfaces/oci:subinterface" XPATH_IPV4ADDRESSES = ".//ociip:ipv4/ociip:addresses/ociip:address" -XPATH_IPV4ADDRESSES = ".//ociip:ipv6/ociip:addresses/ociip:address" +XPATH_IPV6ADDRESSES = ".//ociip:ipv6/ociip:addresses/ociip:address" def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]: response = [] diff --git a/src/webui/requirements.in b/src/webui/requirements.in index b4a158d39..9facefbba 100644 --- a/src/webui/requirements.in +++ b/src/webui/requirements.in @@ -17,3 +17,4 @@ Flask-WTF==1.0.0 flask-healthz==0.0.3 flask-unittest==0.1.2 lorem-text==2.1 +werkzeug==2.3.7 \ No newline at end of file -- GitLab