Commit 1475e174 authored by PabloArmingolRobles's avatar PabloArmingolRobles
Browse files

Device component OCDriver :

- Fixed L3VPN management for ADVA
parent 6dadeffa
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -49,12 +49,13 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
            subinterface = {}

            add_value_from_tag(subinterface, 'name', interface_name)
            add_value_from_tag(subinterface, 'mtu', interface_mtu)

            subinterface_index = xml_subinterface.find('oci:index', namespaces=NAMESPACES)
            if subinterface_index is None or subinterface_index.text is None: continue
            add_value_from_tag(subinterface, 'index', subinterface_index, cast=int)

            vlan_id = xml_subinterface.find('ocv:vlan/ocv:config/ocv:vlan-id', namespaces=NAMESPACES)
            vlan_id = xml_subinterface.find('ocv:vlan/ocv:match/ocv:single-tagged/ocv:config/ocv:vlan-id', namespaces=NAMESPACES)
            add_value_from_tag(subinterface, 'vlan_id', vlan_id, cast=int)

            # TODO: implement support for multiple IP addresses per subinterface
+6 −3
Original line number Diff line number Diff line
@@ -39,10 +39,11 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
        add_value_from_tag(network_instance, 'name', ni_name)

        ni_type = xml_network_instance.find('ocni:config/ocni:type', namespaces=NAMESPACES)
        ni_type.text = ni_type.text.replace('oc-ni-types:','')
        add_value_from_tag(network_instance, 'type', ni_type)

        #ni_router_id = xml_network_instance.find('ocni:config/ocni:router-id', namespaces=NAMESPACES)
        #add_value_from_tag(network_instance, 'router_id', ni_router_id)
        ni_router_id = xml_network_instance.find('ocni:config/ocni:router-id', namespaces=NAMESPACES)
        add_value_from_tag(network_instance, 'router_id', ni_router_id)

        ni_route_dist = xml_network_instance.find('ocni:config/ocni:route-distinguisher', namespaces=NAMESPACES)
        add_value_from_tag(network_instance, 'route_distinguisher', ni_route_dist)
@@ -71,6 +72,8 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
            if protocol['identifier'] == 'BGP':
                bgp_as = xml_protocol.find('ocni:bgp/ocni:global/ocni:config/ocni:as', namespaces=NAMESPACES)
                add_value_from_tag(protocol, 'as', bgp_as, cast=int)
                bgp_id = xml_protocol.find('ocni:bgp/ocni:global/ocni:config/ocni:router-id', namespaces=NAMESPACES)
                add_value_from_tag(protocol, 'router_id', bgp_id)

            resource_key = '/network_instance[{:s}]/protocols[{:s}]'.format(
                network_instance['name'], protocol['identifier'])
@@ -94,7 +97,7 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
            add_value_from_tag(table_connection, 'address_family', address_family,
                               cast=lambda s: s.replace('oc-types:', ''))

            default_import_policy = xml_table_connection.find('ocni:default-import-policy', namespaces=NAMESPACES)
            default_import_policy = xml_table_connection.find('ocni:config/ocni:default-import-policy', namespaces=NAMESPACES)
            add_value_from_tag(table_connection, 'default_import_policy', default_import_policy)

            resource_key = '/network_instance[{:s}]/table_connections[{:s}][{:s}][{:s}]'.format(
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
        resource_key = '/routing_policy/bgp_defined_set[{:s}]'.format(bgp_ext_community_set['ext_community_set_name'])
        response.append((resource_key, copy.deepcopy(bgp_ext_community_set)))

        ext_community_member = xml_bgp_ext_community_set.find('ocbp:ext-community-member', namespaces=NAMESPACES)
        ext_community_member = xml_bgp_ext_community_set.find('ocbp:config/ocbp:ext-community-member', namespaces=NAMESPACES)
        if ext_community_member is not None and ext_community_member.text is not None:
            add_value_from_tag(bgp_ext_community_set, 'ext_community_member', ext_community_member)

+3 −5
Original line number Diff line number Diff line
<interfaces xmlns="http://openconfig.net/yang/interfaces">
    <interface{% if operation is defined and operation != 'delete' %} xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="{{operation}}"{% endif %}>
    <interface{% if operation is defined %} xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="{{operation}}"{% endif %}>
        <name>{{name}}</name>
        {% if operation is defined and operation != 'delete' %}
        <config>
            <name>{{name}}</name>
            {% if operation is defined and operation == 'delete' %}
            <description></description>
            {% else %}
            <description>{{description}}</description>
            <mtu>{{mtu}}</mtu>
            {% endif %}
        </config>
       {% endif %}
    </interface>
</interfaces>
+42 −34
Original line number Diff line number Diff line
<interfaces xmlns="http://openconfig.net/yang/interfaces">
<interfaces xmlns="http://openconfig.net/yang/interfaces" 
            xmlns:oc-ip="http://openconfig.net/yang/interfaces/ip" >
  <interface>
    <name>{{name}}</name>
        {% if operation is not defined or operation != 'delete' %}
    <config>
      <name>{{name}}</name>
      <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:l3ipvlan</type>
      <mtu>{{mtu}}</mtu>
      <enabled>true</enabled>
    </config>
        {% endif %}
    <subinterfaces>
            <subinterface{% if operation is defined %} xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" nc:operation="{{operation}}"{% endif %}>
      <subinterface>
        <index>{{index}}</index>
                {% if operation is not defined or operation != 'delete' %}
        <config>
          <index>{{index}}</index>
                    <enabled>true</enabled>
          <description>{{description}}</description>
        </config>
        <vlan xmlns="http://openconfig.net/yang/vlan">
          <match>
            <single-tagged>
              <config>
                <vlan-id>{{vlan_id}}</vlan-id>
              </config>
            </single-tagged>
          </match>
        </vlan>
                <ipv4 xmlns="http://openconfig.net/yang/interfaces/ip">
                    <addresses>
                        <address>
                            <ip>{{address_ip}}</ip>
                            <config>
                                <ip>{{address_ip}}</ip>
                                <prefix-length>{{address_prefix}}</prefix-length>
                            </config>
                        </address>
                    </addresses>
                </ipv4>
                {% endif %}
        <oc-ip:ipv4>
          <oc-ip:addresses>
            <oc-ip:address>
              <oc-ip:ip>{{address_ip}}</oc-ip:ip>
              <oc-ip:config>
                <oc-ip:ip>{{address_ip}}</oc-ip:ip>
                <oc-ip:prefix-length>{{address_prefix}}</oc-ip:prefix-length>
              </oc-ip:config>
            </oc-ip:address>
          </oc-ip:addresses>
        </oc-ip:ipv4>
        
      </subinterface>
    </subinterfaces>
  </interface>
</interfaces>


Loading