Commit c9afec77 authored by douomo's avatar douomo
Browse files

fixing on getIfaceMetrics 2

parent a9b5cc65
Loading
Loading
Loading
Loading
−10 B (7.52 KiB)

File changed.

No diff preview for this file type.

+1 −1
Original line number Original line Diff line number Diff line
@@ -38,7 +38,7 @@ def get_iface_metrics(m, int_name, metric):
    iface = tree.findall(".//if:"+"interface", namespaces=ns)
    iface = tree.findall(".//if:"+"interface", namespaces=ns)
    if len(iface)>0:
    if len(iface)>0:
        BuiltIn().log_to_console("Found iface")
        BuiltIn().log_to_console("Found iface")
        value = iface[0].find(".//mwrl:"+metric, namespaces=ns)
        value = tree.find(".//mwrl:"+metric, namespaces=ns)
        if value==None:
        if value==None:
            BuiltIn().log_to_console(metric+" not found")
            BuiltIn().log_to_console(metric+" not found")
            return metric+" not found"        
            return metric+" not found"        
+6 −10
Original line number Original line Diff line number Diff line
@@ -15,16 +15,12 @@ def get_iface_metrics(m, metric):
    'ianaift': 'urn:ietf:params:xml:ns:yang:iana-if-type'
    'ianaift': 'urn:ietf:params:xml:ns:yang:iana-if-type'
    }
    }
    tree = ET.fromstring(cfg)
    tree = ET.fromstring(cfg)
    iface = tree.findall(".//if:"+"interface", namespaces=ns)
    if len(iface)>0:
    print("Found iface")
    print("Found iface")
        value = iface[0].findall(".//mwrl:"+metric, namespaces=ns)
    value = tree.findall(".//mwrl:"+metric, namespaces=ns)
    if len(value)==0:
    if len(value)==0:
        print(metric+" not found")
        print(metric+" not found")
        return metric+" not found"        
        return metric+" not found"        
    return value[0].text
    return value[0].text
    else:
        return "No iface found"
    
    
def set_TX_power(int_name, txPower):
def set_TX_power(int_name, txPower):
    env = Environment( loader=FileSystemLoader("."), autoescape=False)
    env = Environment( loader=FileSystemLoader("."), autoescape=False)