Commit d7dc61b1 authored by douomo's avatar douomo
Browse files

update on the counters for partial fails

parent 2a16a01a
Loading
Loading
Loading
Loading
+48 −41
Original line number Original line Diff line number Diff line
@@ -26,7 +26,7 @@ def check_hardware_inventory(xml_reply):
        if len(cls)==0:
        if len(cls)==0:
            actual_params = actual_params - 1
            actual_params = actual_params - 1
            #return "Component class not found"
            #return "Component class not found"
        if len(hw_rev)>0:
        if len(hw_rev)==0:
            actual_params = actual_params - 1
            actual_params = actual_params - 1
            #return "hw rev not found"
            #return "hw rev not found"
        if len(parent_rel_pos)==0:
        if len(parent_rel_pos)==0:
@@ -286,23 +286,23 @@ def check_svc_inventory(xml_reply):
            #return "mssing bridge's info"
            #return "mssing bridge's info"
            actual_params = actual_params - 4 + len(name) + len(address) + len(bridge_type) + len(components)
            actual_params = actual_params - 4 + len(name) + len(address) + len(bridge_type) + len(components)
        for component in components:
        for component in components:
            expected_params = expected_params + 8
            expected_params = expected_params + 6
            actual_params = actual_params + 8
            actual_params = actual_params + 6
            name = component.findall(".//ns0:name", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            name = component.findall(".//ns0:name", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            id = component.findall(".//ns0:id", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            id = component.findall(".//ns0:id", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            type = component.findall(".//ns0:type", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            type = component.findall(".//ns0:type", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            bridge_port = component.findall(".//ns0:bridge-port", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            bridge_port = component.findall(".//ns0:bridge-port", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            filtering_database = component.findall(".//ns0:filtering-database", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            filtering_database = component.findall(".//ns0:filtering-database", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            bridge_vlan = component.findall(".//ns0:bridge-vlan", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            bridge_vlan = component.findall(".//ns0:bridge-vlan", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            vlan_reg_entry = filtering_database[0].findall(".//ns0:vlan-registration-entry", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            vlans = bridge_vlan[0].findall(".//ns0:vlan", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
            if len(name)==0 or len(id)==0 or len(type)==0 or len(bridge_port)==0 or len(filtering_database)==0 or len(bridge_vlan)==0:
            if len(name)==0 or len(id)==0 or len(type)==0 or len(bridge_port)==0 or len(filtering_database)==0 or len(bridge_vlan)==0:
                #return "missing components's info"
                #return "missing components's info"
                actual_params = actual_params - 6 + len(name) + len(id) + len(type) + len(bridge_port) + len(filtering_database) + len(bridge_vlan)
                actual_params = actual_params - 6 + len(name) + len(id) + len(type) + len(bridge_port) + len(filtering_database) + len(bridge_vlan)
            if len(vlan_reg_entry)==0:
            
                actual_params = actual_params - 1
            for db in filtering_database:
            if len(vlans)==0:
                expected_params = expected_params + 1 #if there's the filtering db I expect to see also vlan_reg_entry
                actual_params = actual_params - 1
                vlan_reg_entry = db.findall(".//ns0:vlan-registration-entry", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
                if len(vlan_reg_entry)>0:
                    actual_params = actual_params + 1
                    for v in vlan_reg_entry:
                    for v in vlan_reg_entry:
                        actual_params = actual_params + 4
                        actual_params = actual_params + 4
                        expected_params = expected_params + 4
                        expected_params = expected_params + 4
@@ -326,6 +326,12 @@ def check_svc_inventory(xml_reply):
                            if len(port_ref)==0 or len(static_vlan_reg_entry)==0 or len(vlan_transmitted)==0 or len(registrar_admin_control)==0:
                            if len(port_ref)==0 or len(static_vlan_reg_entry)==0 or len(vlan_transmitted)==0 or len(registrar_admin_control)==0:
                                #return "Missing data in port map"
                                #return "Missing data in port map"
                                actual_params = actual_params - 4 + len(port_ref) + len(static_vlan_reg_entry) + len(vlan_transmitted) + len(registrar_admin_control)
                                actual_params = actual_params - 4 + len(port_ref) + len(static_vlan_reg_entry) + len(vlan_transmitted) + len(registrar_admin_control)
            
            for br in bridge_vlan:
                expected_params = expected_params + 1 #if there's a bridge_vlan I also expect to see vlans
                vlans = br.findall(".//ns0:vlan", namespaces={"ns0": "urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"})
                if len(vlans)>0:
                    actual_params = actual_params + 1
                    for vlan in vlans:
                    for vlan in vlans:
                        expected_params = expected_params + 3
                        expected_params = expected_params + 3
                        actual_params = actual_params + 3
                        actual_params = actual_params + 3
@@ -335,6 +341,7 @@ def check_svc_inventory(xml_reply):
                        if len(vid)==0 or len(name)==0 or len(egress_ports)==0:
                        if len(vid)==0 or len(name)==0 or len(egress_ports)==0:
                            #return "Missing data in bridge vlan"
                            #return "Missing data in bridge vlan"
                            actual_params = actual_params - 3 + len(vid) + len(name) + len(egress_ports)
                            actual_params = actual_params - 3 + len(vid) + len(name) + len(egress_ports)
            
    if actual_params<expected_params:
    if actual_params<expected_params:
        return "expected params = ",expected_params," got ", actual_params
        return "expected params = ",expected_params," got ", actual_params
    return "SUCCESS"
    return "SUCCESS"
 No newline at end of file