Commit 40f887de authored by PabloArmingolRobles's avatar PabloArmingolRobles
Browse files

Virtual Circuit

parent 476fd720
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ XPATH_NI_IIP_AP = ".//ocni:inter-instance-policies/ocni:apply-policy"
XPATH_NI_IIP_AP_IMPORT  = ".//ocni:config/ocni:import-policy"
XPATH_NI_IIP_AP_EXPORT  = ".//ocni:config/ocni:export-policy"

XPATH_NI_CPOINTS          = ".//ocni:connection-points/ocni:connection-point"
XPATH_NI_CPOINTS_ENDPOINT = ".//ocni:endpoints/ocni:endpoint/ocni:remote/ocni:config"

def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
    response = []
    for xml_network_instance in xml_data.xpath(XPATH_NETWORK_INSTANCES, namespaces=NAMESPACES):
@@ -54,6 +57,20 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
        if len(network_instance) == 0: continue
        response.append(('/network_instance[{:s}]'.format(network_instance['name']), network_instance))

        for xml_cpoints in xml_network_instance.xpath(XPATH_NI_PROTOCOLS, namespaces=NAMESPACES):
            cpoint = {}
            add_value_from_tag(cpoint, 'name', ni_name)

            connection_point = xml_cpoints.find('ocni:connection-point-id', namespaces=NAMESPACES)
            add_value_from_tag(cpoint, 'connection_point', connection_point)

            for xml_endpoint in xml_cpoints.xpath(XPATH_NI_CPOINTS_ENDPOINT, namespaces=NAMESPACES):
                remote_system = xml_endpoint.find('ocni:remote-system', namespaces=NAMESPACES)
                add_value_from_tag(cpoint, 'remote_system', remote_system)

                VC_ID = xml_endpoint.find('ocni:virtual-circuit-identifier', namespaces=NAMESPACES)
                add_value_from_tag(cpoint, 'VC_ID', VC_ID)

        for xml_protocol in xml_network_instance.xpath(XPATH_NI_PROTOCOLS, namespaces=NAMESPACES):
            #LOGGER.info('xml_protocol = {:s}'.format(str(ET.tostring(xml_protocol))))

@@ -128,4 +145,7 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
                    iip_ap['name'], iip_ap['export_policy'])
                response.append((resource_key, iip_ap))




    return response
+27 −0
Original line number Diff line number Diff line
<network-instances xmlns="http://openconfig.net/yang/network-instance">
    <network-instance>
        <name>ELAN-VC:789</name>
        <connection-point>
            <connection-point-id>{{connection_point}}</connection-point-id>
            <config>
                <connection-point-id>{{connection_point}}</connection-point-id>
            </config>
            <endpoints>
                <endpoint>
                    <endpoint-id>{{connection_point}}</endpoint-id>
                    <config>
                        <endpoint-id>{{connection_point}}</endpoint-id>
                        <precedence>1</precedence>
                        <type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:REMOTE</type>
                    </config>
                    <remote>
                        <config>
                            <virtual-circuit-identifier>{{VC_ID}}</virtual-circuit-identifier>
                            <remote-system>{{remote_system}}</remote-system>
                        </config>
                    </remote>
                </endpoint>
            </endpoints>
        </connection-point>
    </network-instance>
</network-instances>
 No newline at end of file