Esempio n. 1
0
def _iosxr_get_vrf_netconf(task, options={}):
    with manager.connect(host=task.host.hostname,
                         port=task.host.port,
                         username=task.host.username,
                         password=task.host.password,
                         hostkey_verify=False,
                         device_params={'name': 'iosxr'}) as m:

        vrf_config = m.get_config(
            source='running',
            filter=NETCONF_FILTER.format(
                "<vrfs "
                "xmlns=\"http://cisco.com/ns/yang/Cisco-IOS-XR-infra-rsi-cfg\""
                "/>")).data_xml

        bgp_config = m.get_config(
            source='running',
            filter=NETCONF_FILTER.format(
                "<bgp "
                "xmlns=\"http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-bgp-cfg\""
                "/>")).data_xml

    ElementTree.fromstring(vrf_config)
    ElementTree.fromstring(bgp_config)

    config = dict()
    config['BGP'] = bgp_config
    config['VRF'] = vrf_config

    task.host[VRF_DATA_KEY] = _iosxr_vrf_netconf_converter(
        hostname=task.host.name, cmd_output=config, options=options)
Esempio n. 2
0
def step_impl(context):
    config = dict()
    config['VRF'] = open_txt_file(
        path=(f"{FEATURES_SRC_PATH}outputs/vrf/iosxr/netconf/"
              "cisco_iosxr_nc_get_vrf_one_vrf.xml"))
    config['BGP'] = open_txt_file(
        path=(f"{FEATURES_SRC_PATH}outputs/vrf/iosxr/netconf/"
              "cisco_iosxr_nc_get_bgp_one_vrf.xml"))

    context.o0423 = _iosxr_vrf_netconf_converter(hostname="spine03",
                                                 cmd_output=config)