diff --git a/inventory_provider/juniper.py b/inventory_provider/juniper.py index 723ab2bc40936cc97da6bbe9b1649bcaf55302c7..5bf4edff6a67d0407dfaddd27c36d90d729d890d 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