Commit 49c57dbe authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component - gNMI OpenConfig driver:

- Fixed configuration of interface type, if provided
parent 931146e6
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -24,11 +24,6 @@ MIN_MTU = 68


def _normalize_interface_type(if_type: str, sif_index: int) -> str:
    # In this driver, subinterfaces are modeled under the parent physical interface.
    # Requests coming from service handlers may still use l3ipvlan to express routed
    # subinterface intent, which needs to be translated to an Ethernet parent type.
    if if_type == 'l3ipvlan' and sif_index is not None:
        return 'iana-if-type:ethernetCsmacd'
    if ':' not in if_type:
        return 'iana-if-type:{:s}'.format(if_type)
    return if_type
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ from device.service.drivers.gnmi_openconfig.handlers.Interface import InterfaceH
from device.service.drivers.gnmi_openconfig.handlers.YangHandler import YangHandler


def test_compose_tagged_l3_subinterface_sets_parent_ethernet_type() -> None:
def test_compose_tagged_l3_subinterface_keeps_l3ipvlan_type() -> None:
    handler = InterfaceHandler()
    yang_handler = YangHandler()
    try:
@@ -40,7 +40,7 @@ def test_compose_tagged_l3_subinterface_sets_parent_ethernet_type() -> None:
        yang_handler.destroy()

    json_data = json.loads(str_data)
    assert json_data['config']['type'] == 'iana-if-type:ethernetCsmacd'
    assert json_data['config']['type'] == 'iana-if-type:l3ipvlan'

    subinterface = json_data['subinterfaces']['subinterface'][0]
    assert subinterface['index'] == 125