Skip to content
Snippets Groups Projects
Commit 48d501c2 authored by Robert Latta's avatar Robert Latta
Browse files

updated schema

parent 72c55fe6
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,8 @@ CONFIG_SCHEMA = """<?xml version="1.1" encoding="UTF-8" ?> ...@@ -43,6 +43,8 @@ CONFIG_SCHEMA = """<?xml version="1.1" encoding="UTF-8" ?>
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:choice minOccurs="1" maxOccurs="unbounded"> <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="version" minOccurs="0" type="xs:string" />
<xs:element name="groups" minOccurs="0" type="generic-sequence" /> <xs:element name="groups" minOccurs="0" type="generic-sequence" />
<xs:element name="apply-groups" minOccurs="0" type="xs:string" /> <xs:element name="apply-groups" minOccurs="0" type="xs:string" />
...@@ -155,20 +157,22 @@ def validate_netconf_config(config_doc): ...@@ -155,20 +157,22 @@ def validate_netconf_config(config_doc):
_validate(unit_schema, u) _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 returns as an lxml etree doc
:param hostname: router hostname :param hostname: router hostname
:param ssh_params: 'ssh' config element(cf. config.py:CONFIG_SCHEMA) :param ssh_params: 'ssh' config element(cf. config.py:CONFIG_SCHEMA)
:param validate: whether or not to validate netconf data (default True)
:return: :return:
:raises: NetconfHandlingError from validate_netconf_config :raises: NetconfHandlingError from validate_netconf_config
""" """
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logger.info("capturing netconf data for '%s'" % hostname) logger.info("capturing netconf data for '%s'" % hostname)
config = _rpc(hostname, ssh_params).get_config() config = _rpc(hostname, ssh_params).get_config()
validate_netconf_config(config) if validate:
validate_netconf_config(config)
return config return config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment