Commit 476fd720 authored by PabloArmingolRobles's avatar PabloArmingolRobles
Browse files

L2-VPN

parent 23b42b08
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -37,6 +37,10 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:
        #interface_type = xml_interface.find('oci:config/oci:type', namespaces=NAMESPACES)
        #add_value_from_tag(interface, 'type', interface_type)

        interface_type = xml_interface.find('oci:config/oci:type', namespaces=NAMESPACES)
        interface_type.text = interface_type.text.replace('ianaift:','')
        add_value_from_tag(interface, 'type', interface_type)

        interface_mtu = xml_interface.find('oci:config/oci:mtu', namespaces=NAMESPACES)
        add_value_from_tag(interface, 'mtu', interface_mtu, cast=int)

@@ -50,6 +54,8 @@ def parse(xml_data : ET.Element) -> List[Tuple[str, Dict[str, Any]]]:

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


            subinterface_index = xml_subinterface.find('oci:index', namespaces=NAMESPACES)
            if subinterface_index is None or subinterface_index.text is None: continue
+4 −3
Original line number Diff line number Diff line
@@ -4,8 +4,8 @@
    <name>{{name}}</name>
    <config>
      <name>{{name}}</name>
      <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:l3ipvlan</type>
      <mtu>{{mtu}}</mtu>
      <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:{{type}}</type>
      {% if mtu is defined %}<mtu>{{mtu}}</mtu>{% endif%}
      <enabled>true</enabled>
    </config>
    <subinterfaces>
@@ -24,6 +24,7 @@
            </single-tagged>
          </match>
        </vlan>
        {% if address_ip is defined %}
        <oc-ip:ipv4>
          <oc-ip:addresses>
            <oc-ip:address>
@@ -35,7 +36,7 @@
            </oc-ip:address>
          </oc-ip:addresses>
        </oc-ip:ipv4>
        
        {% endif%}
      </subinterface>
    </subinterfaces>
  </interface>
+21 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
        <config>
            <name>{{name}}</name>
            <type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:{{type}}</type>
            {% if type=='L3VRF' %}
            {% if description is defined %}<description>{{description}}</description>{% endif %}
            {% if router_id is defined %}<router-id>{{router_id}}</router-id>{% endif %}
            <route-distinguisher>{{route_distinguisher}}</route-distinguisher>
@@ -17,5 +18,25 @@
            </config>
        </encapsulation>
            {% endif %}
            {% if type=='L2VSI' %}
            {% if description is defined %}<description>{{description}}</description>{% endif %}
            <enabled>false</enabled>
            <mtu>1500</mtu>
        </config>
        <encapsulation>
            <config>
                <encapsulation-type xmlns:oc-ni-types="http://openconfig.net/yang/network-instance-types">oc-ni-types:MPLS</encapsulation-type>
            </config>
        </encapsulation>
        <fdb>
            <config>
                <mac-learning>true</mac-learning>
                <maximum-entries>1000</maximum-entries>
                <mac-aging-time>300</mac-aging-time>
            </config>
        </fdb>
            {% endif %}

        {% endif %}
    </network-instance>
</network-instances>