From 48d501c2d08da6bc21447710171ec16dd9aedc28 Mon Sep 17 00:00:00 2001 From: Robert Latta <robert.latta@geant.org> Date: Mon, 25 Jan 2021 17:34:58 +0000 Subject: [PATCH] updated schema --- inventory_provider/juniper.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/inventory_provider/juniper.py b/inventory_provider/juniper.py index 723ab2bc..5bf4edff 100644 --- a/inventory_provider/juniper.py +++ b/inventory_provider/juniper.py @@ -43,6 +43,8 @@ CONFIG_SCHEMA = """<?xml version="1.1" encoding="UTF-8" ?> <xs:complexType> <xs:sequence> <xs:choice minOccurs="1" maxOccurs="unbounded"> + <xs:element name="transfer-on-commit" minOccurs="0" type="xs:string" /> + <xs:element name="archive-sites" minOccurs="0" type="generic-sequence" /> <xs:element name="version" minOccurs="0" type="xs:string" /> <xs:element name="groups" minOccurs="0" type="generic-sequence" /> <xs:element name="apply-groups" minOccurs="0" type="xs:string" /> @@ -155,20 +157,22 @@ def validate_netconf_config(config_doc): _validate(unit_schema, u) -def load_config(hostname, ssh_params): +def load_config(hostname, ssh_params, validate=True): """ - loads netconf data from the router, validates and + loads netconf data from the router, validates (by default) and returns as an lxml etree doc :param hostname: router hostname :param ssh_params: 'ssh' config element(cf. config.py:CONFIG_SCHEMA) + :param validate: whether or not to validate netconf data (default True) :return: :raises: NetconfHandlingError from validate_netconf_config """ logger = logging.getLogger(__name__) logger.info("capturing netconf data for '%s'" % hostname) config = _rpc(hostname, ssh_params).get_config() - validate_netconf_config(config) + if validate: + validate_netconf_config(config) return config -- GitLab