X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fhoneycomb%2FHcAPIKwInterfaces.py;h=e8cbc78bea7fbbed2fa03cedfa2858c678bb9af1;hp=c143b069db38901c210d02c0d18f7e5435117448;hb=ce469c1a7d56c2be639e5cecde961c4ef6354fb5;hpb=6000b2abc3d6b8bb8ff2941aacf005a04a33be60 diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index c143b069db..e8cbc78bea 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -1047,3 +1047,29 @@ class InterfaceKeywords(object): "vlan-tag-rewrite") return InterfaceKeywords._set_interface_properties( node, sub_interface, path, None) + + @staticmethod + def compare_interface_lists(list1, list2): + """Compare provided lists of interfaces by name. + + :param list1: List of interfaces. + :param list2: List of interfaces. + :type list1: list + :type list2: list + :raises HoneycombError: If an interface exists in only one of the lists. + """ + + ignore = ["vx_tunnel0", "vxlan_gpe_tunnel0"] + # these have no equivalent in config data and no effect on VPP + + names1 = [x['name'] for x in list1] + names2 = [x['name'] for x in list2] + + for name in names1: + if name not in names2 and name not in ignore: + raise HoneycombError("Interface {0} not present in list {1}" + .format(name, list2)) + for name in names2: + if name not in names1 and name not in ignore: + raise HoneycombError("Interface {0} not present in list {1}" + .format(name, list1))