X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2Fnetvirt%2Fexcepts.py;h=3e1c4d83303b069d224aabc55034faef8aadbc8b;hb=d80748c4311ba1a78647366f3fbfb188d606a931;hp=26597fdf6be7c5a5fa80e3deb8c774c607bccf71;hpb=126ef72c7a9e832afeb3fd5c756b361ba3cd865d;p=integration%2Ftest.git diff --git a/csit/libraries/netvirt/excepts.py b/csit/libraries/netvirt/excepts.py index 26597fdf6b..3e1c4d8330 100644 --- a/csit/libraries/netvirt/excepts.py +++ b/csit/libraries/netvirt/excepts.py @@ -1,156 +1,228 @@ import collections +import errno import logging +import os import re # Make sure to have unique matches in different lines # Order the list in alphabetical order based on the "issue" key _whitelist = [ - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-972", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was created by other transaction", - "Optimistic lock failed for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + - "[{(urn:opendaylight:inventory?revision=2013-08-19)id=openflow", - "table/table[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=21}]/flow/flow" + - "[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=L3.", - "Conflicting modification for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + - "[{(urn:opendaylight:inventory?revision=2013-08-19)id=", - "table/table[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=21}]/flow/flow" + - "[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=L3.", ".21.", ".42." - ]}, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-972", + "id": "ConflictingModificationAppliedException", + "context": [ + "Node was created by other transaction", + "Optimistic lock failed for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + + "[{(urn:opendaylight:inventory?revision=2013-08-19)id=openflow", + "table/table[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=21}]/flow/flow" + + "[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=L3.", + ], + }, # oxygen - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-972", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was created by other transaction", - "OptimisticLockFailedException: Optimistic lock failed." - "Conflicting modification for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + - "[{(urn:opendaylight:inventory?revision=2013-08-19)id=", - "table/table[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=21}]/flow/flow" + - "[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=L3.", ".21.", ".42." - ]}, - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-1135", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was created by other transaction", - "Optimistic lock failed for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + - "[{(urn:opendaylight:inventory?revision=2013-08-19)id=openflow:", - "Conflicting modification for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + - "[{(urn:opendaylight:inventory?revision=2013-08-19)id=openflow:", - "table/table[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=47}]/flow/flow" + - "[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=SNAT.", ".47." - ]}, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-972", + "id": "ConflictingModificationAppliedException", + "context": [ + "Node was created by other transaction", + "OptimisticLockFailedException: Optimistic lock failed." + "Conflicting modification for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + + "[{(urn:opendaylight:inventory?revision=2013-08-19)id=", + "table/table[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=21}]/flow/flow" + + "[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=L3.", + ".21.", + ".42.", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1135", + "id": "ConflictingModificationAppliedException", + "context": [ + "Node was created by other transaction", + "Optimistic lock failed for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + + "[{(urn:opendaylight:inventory?revision=2013-08-19)id=openflow:", + ], + }, # oxygen - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-1135", - "id": "ConflictingModificationAppliedException", - "context": [ - "OptimisticLockFailedException: Optimistic lock failed." - "Conflicting modification for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + - "[{(urn:opendaylight:inventory?revision=2013-08-19)id=openflow:", - "table/table[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=47}]/flow/flow" + - "[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=SNAT.", ".47." - ]}, - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-1136", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was deleted by other transaction", - "Optimistic lock failed for path /(urn:opendaylight:netvirt:elan?revision=2015-06-02)elan-" + - "forwarding-tables/mac-table/mac-table[{(urn:opendaylight:netvirt:elan?revision=2015-06-02)" + - "elan-instance-name=", - "Conflicting modification for path /(urn:opendaylight:netvirt:elan?revision=2015-06-02)elan-" + - "forwarding-tables/mac-table/mac-table[{(urn:opendaylight:netvirt:elan?revision=2015-06-02)" + - "elan-instance-name=" - ]}, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1135", + "id": "ConflictingModificationAppliedException", + "context": [ + "OptimisticLockFailedException: Optimistic lock failed." + "Conflicting modification for path /(urn:opendaylight:inventory?revision=2013-08-19)nodes/node/node" + + "[{(urn:opendaylight:inventory?revision=2013-08-19)id=openflow:", + "table/table[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=47}]/flow/flow" + + "[{(urn:opendaylight:flow:inventory?revision=2013-08-19)id=SNAT.", + ".47.", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1136", + "id": "ConflictingModificationAppliedException", + "context": [ + "Node was deleted by other transaction", + "Optimistic lock failed for path /(urn:opendaylight:netvirt:elan?revision=2015-06-02)elan-" + + "forwarding-tables/mac-table/mac-table[{(urn:opendaylight:netvirt:elan?revision=2015-06-02)" + + "elan-instance-name=", + ], + }, # oxygen version of NETVIRT-1136 - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-1136", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was deleted by other transaction", - "OptimisticLockFailedException: Optimistic lock failed.", - "Conflicting modification for path /(urn:opendaylight:netvirt:elan?revision=2015-06-02)elan-" + - "forwarding-tables/mac-table/mac-table[{(urn:opendaylight:netvirt:elan?revision=2015-06-02)" + - "elan-instance-name=" - ]}, - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-1260", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was deleted by other transaction", - "Optimistic lock failed for path /(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)" + - "interfaces/interface/interface[{(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)name=", - "Conflicting modification for path /(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)" + - "interfaces/interface/interface[{(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)name=" - ]}, - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-1270", - "id": "ConflictingModificationAppliedException", - "context": [ - "ConflictingModificationAppliedException: Node children was modified by other transaction", - "OptimisticLockFailedException", - "Conflicting modification for path /(urn:opendaylight:netvirt:l3vpn?revision=2013-09-11)" + - "vpn-instance-op-data/vpn-instance-op-data-entry/vpn-instance-op-data-entry" + - "[{(urn:opendaylight:netvirt:l3vpn?revision=2013-09-11)vrf-id=" - ]}, - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-1270", - "id": "ExecutionException", - "context": [ - "OptimisticLockFailedException: Optimistic lock failed", - "ConflictingModificationAppliedException: Node children was modified by other transaction", - "removeOrUpdateVpnToDpnList: Error removing from dpnToVpnList for vpn " - ]}, - {"issue": "https://jira.opendaylight.org/browse/NETVIRT-1281", - "id": "OptimisticLockFailedException", - "context": [ - "OptimisticLockFailedException: Optimistic lock failed.", - "ConflictingModificationAppliedException: Node children was modified by other transaction", - "Direct Exception (not failed Future) when executing job, won't even retry: JobEntry{key='VPNINTERFACE-" - ]}, - {"issue": "https://jira.opendaylight.org/browse/NEUTRON-157", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was deleted by other transaction", - "Optimistic lock failed for path /(urn:opendaylight:neutron?revision=2015-07-12)" + - "neutron/networks/network/network[{(urn:opendaylight:neutron?revision=2015-07-12)uuid=", - "Conflicting modification for path /(urn:opendaylight:neutron?revision=2015-07-12)" + - "neutron/networks/network/network[{(urn:opendaylight:neutron?revision=2015-07-12)uuid=" - ]}, - {"issue": "https://jira.opendaylight.org/browse/NEUTRON-157", - "id": "ConflictingModificationAppliedException", - "context": [ - "Got OptimisticLockFailedException", "NeutronNetwork [networkUUID=", - "AbstractTranscriberInterface" - ]}, - {"issue": "https://jira.opendaylight.org/browse/NEUTRON-157", - "id": "ConflictingModificationAppliedException", - "context": [ - "Got OptimisticLockFailedException", - "AbstractTranscriberInterface" - ]}, - {"issue": "https://jira.opendaylight.org/browse/NEUTRON-157", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was created by other transaction", - "Optimistic lock failed for path /(urn:opendaylight:neutron?revision=2015-07-12)neutron" - ]}, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1136", + "id": "ConflictingModificationAppliedException", + "context": [ + "Node was deleted by other transaction", + "OptimisticLockFailedException: Optimistic lock failed.", + "Conflicting modification for path /(urn:opendaylight:netvirt:elan?revision=2015-06-02)elan-" + + "forwarding-tables/mac-table/mac-table[{(urn:opendaylight:netvirt:elan?revision=2015-06-02)" + + "elan-instance-name=", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1260", + "id": "ConflictingModificationAppliedException", + "context": [ + "Optimistic lock failed for path /(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)" + + "interfaces/interface/interface[{(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)name=" + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1270", + "id": "ConflictingModificationAppliedException", + "context": [ + "OptimisticLockFailedException", + "/(urn:opendaylight:netvirt:l3vpn?revision=2013-09-11)" + + "vpn-instance-op-data/vpn-instance-op-data-entry/vpn-instance-op-data-entry" + + "[{(urn:opendaylight:netvirt:l3vpn?revision=2013-09-11)vrf-id=", + "vrf-id=", + "/vpn-to-dpn-list/vpn-to-dpn-list", + "dpnId=", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1270", + "id": "ExecutionException", + "context": [ + "OptimisticLockFailedException: Optimistic lock failed", + "removeOrUpdateVpnToDpnList: Error removing from dpnToVpnList for vpn ", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1270", + "id": "OptimisticLockFailedException", + "context": [ + "OptimisticLockFailedException", + "VpnInterfaceOpListener", + "Direct Exception (not failed Future) when executing job, won't even retry: JobEntry{key='VPNINTERFACE-", + "vpn-instance-op-data/vpn-instance-op-data-entry/vpn-instance-op-data-entry" + + "[{(urn:opendaylight:netvirt:l3vpn?revision=2013-09-11)vrf-id=", + "vrf-id=", + "/vpn-to-dpn-list/vpn-to-dpn-list", + "dpnId=", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1281", + "id": "OptimisticLockFailedException", + "context": [ + "OptimisticLockFailedException: Optimistic lock failed.", + "ConflictingModificationAppliedException: Node children was modified by other transaction", + "Direct Exception (not failed Future) when executing job, won't even retry: JobEntry{key='VPNINTERFACE-", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1304", + "id": "ModifiedNodeDoesNotExistException", + "context": [ + "ModifiedNodeDoesNotExistException", + "/(urn:opendaylight:netvirt:fibmanager?revision=2015-03-30)fibEntries/" + + "vrfTables/vrfTables[{(urn:opendaylight:netvirt:fibmanager?revision=2015-03-30)routeDistinguisher=", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1304", + "id": "TransactionCommitFailedException", + "context": [ + "TransactionCommitFailedException", + "/(urn:opendaylight:netvirt:fibmanager?revision=2015-03-30)fibEntries/" + + "vrfTables/vrfTables[{(urn:opendaylight:netvirt:fibmanager?revision=2015-03-30)routeDistinguisher=", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1427", + "id": "ModifiedNodeDoesNotExistException", + "context": [ + "/(urn:huawei:params:xml:ns:yang:l3vpn?revision=2014-08-15)vpn-interfaces/vpn-interface/vpn-interface" + + "[{(urn:huawei:params:xml:ns:yang:l3vpn?revision=2014-08-15)name=", + "AugmentationIdentifier{childNames=[(urn:opendaylight:netvirt:l3vpn?revision=2013-09-11)adjacency]}", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1428", + "id": "ModifiedNodeDoesNotExistException", + "context": [ + "/(urn:huawei:params:xml:ns:yang:l3vpn?revision=2014-08-15)vpn-interfaces/vpn-interface/vpn-interface" + + "[{(urn:huawei:params:xml:ns:yang:l3vpn?revision=2014-08-15)name=" + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NEUTRON-157", + "id": "ConflictingModificationAppliedException", + "context": [ + "Optimistic lock failed for path /(urn:opendaylight:neutron?revision=2015-07-12)" + + "neutron/networks/network/network[{(urn:opendaylight:neutron?revision=2015-07-12)uuid=", + "Conflicting modification for path /(urn:opendaylight:neutron?revision=2015-07-12)" + + "neutron/networks/network/network[{(urn:opendaylight:neutron?revision=2015-07-12)uuid=", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NEUTRON-157", + "id": "OptimisticLockFailedException", + "context": [ + "Got OptimisticLockFailedException", + "AbstractTranscriberInterface", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NEUTRON-157", + "id": "ConflictingModificationAppliedException", + "context": [ + "Optimistic lock failed for path /(urn:opendaylight:neutron?revision=2015-07-12)neutron" + ], + }, # oxygen - {"issue": "https://jira.opendaylight.org/browse/NEUTRON-157", - "id": "ConflictingModificationAppliedException", - "context": [ - "Node was deleted by other transaction", - "OptimisticLockFailedException: Optimistic lock failed.", - "Conflicting modification for path /(urn:opendaylight:neutron?revision=2015-07-12)" + - "neutron/networks/network/network[{(urn:opendaylight:neutron?revision=2015-07-12)uuid=", - ]}, - {"issue": "https://jira.opendaylight.org/browse/OPNFLWPLUG-917", - "id": "IllegalStateException", - "context": [ - "java.lang.IllegalStateException: Deserializer for key: msgVersion: 4 objectClass: " + - "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry " + - "msgType: 1 oxm_field: 33 experimenterID: null was not found " + - "- please verify that all needed deserializers ale loaded correctly" - ]} + { + "issue": "https://jira.opendaylight.org/browse/NEUTRON-157", + "id": "ConflictingModificationAppliedException", + "context": [ + "OptimisticLockFailedException: Optimistic lock failed.", + "Conflicting modification for path /(urn:opendaylight:neutron?revision=2015-07-12)" + + "neutron/networks/network/network[{(urn:opendaylight:neutron?revision=2015-07-12)uuid=", + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/OPNFLWPLUG-917", + "id": "IllegalStateException", + "context": [ + "java.lang.IllegalStateException: Deserializer for key: msgVersion: 4 objectClass: " + + "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry " + + "msgType: 1 oxm_field: 33 experimenterID: null was not found " + + "- please verify that all needed deserializers ale loaded correctly" + ], + }, + { + "issue": "https://jira.opendaylight.org/browse/NETVIRT-1640", + "id": "ElasticsearchAppender", + "context": [ + "Can't append into Elasticsearch", + "org.apache.karaf.decanter.appender.elasticsearch - 1.0.0", + ], + }, ] _re_ts = re.compile(r"^[0-9]{4}(-[0-9]{2}){2}T([0-9]{2}:){2}[0-9]{2},[0-9]{3}") -_re_ts_we = re.compile(r"^[0-9]{4}(-[0-9]{2}){2}T([0-9]{2}:){2}[0-9]{2},[0-9]{3}( \| ERROR \| | \| WARN \| )") +_re_ts_we = re.compile( + r"^[0-9]{4}(-[0-9]{2}){2}T([0-9]{2}:){2}[0-9]{2},[0-9]{3}( \| ERROR \| | \| WARN \| )" +) _re_ex = re.compile(r"(?i)exception") _ex_map = collections.OrderedDict() _ts_list = [] @@ -165,7 +237,7 @@ def get_exceptions(lines): The lines are parsed to create a list where all lines related to a timestamp are aggregated. Timestamped lines with exception (case insensitive) are copied to the exception map keyed to the index of the timestamp line. Each exception value - also has a 3 element list containing the last three WARN and ERROR lines. + also has a list containing WARN and ERROR lines proceeding the exception. :param list lines: :return OrderedDict _ex_map: map of exceptions @@ -198,7 +270,7 @@ def get_exceptions(lines): if ex: index = len(_ts_list) - 1 if index not in _ex_map: - _ex_map[index] = {"warnerr_list": list(warnerr_deq), 'lines': cur_list} + _ex_map[index] = {"warnerr_list": list(warnerr_deq), "lines": cur_list} warnerr_deq.clear() # reset the deque to only track new ERROR and WARN lines return _ex_map @@ -252,3 +324,38 @@ def verify_exceptions(lines): return get_exceptions(lines) return check_exceptions() + + +def write_exceptions_map_to_file(testname, filename, mode="a+"): + """ + Write the exceptions map to a file under the testname header. The output + will include all lines in the exception itself as well as any previous + contextual warning or error lines. The output will be appended or overwritten + depending on the mode parameter. It is assumed that the caller has called + verify_exceptions() earlier to populate the exceptions map, otherwise only + the testname and header will be printed to the file. + + :param str testname: The name of the test + :param str filename: The file to open for writing + :param str mode: Append (a+) or overwrite (w+) + """ + try: + os.makedirs(os.path.dirname(filename)) + except OSError as exception: + if exception.errno != errno.EEXIST: + raise + + with open(filename, mode) as fp: + fp.write("{}\n".format("=" * 60)) + fp.write("Starting test: {}\n".format(testname)) + for ex_idx, ex in _ex_map.items(): + fp.write("{}\n".format("-" * 40)) + if "issue" in ex: + fp.write("Exception was matched to: {}\n".format(ex.get("issue"))) + else: + fp.write("Exception is new\n") + for exwe_index in ex.get("warnerr_list")[:-1]: + for line in _ts_list[exwe_index]: + fp.write("{}\n".format(line)) + fp.writelines(ex.get("lines")) + fp.write("\n")