aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/L2Util.py
AgeCommit message (Expand)AuthorFilesLines
2019-11-28Python3: resources and librariesJan Gelety1-138/+155
2019-07-17Use PapiSocketProvider for most PAPI callsVratko Polak1-18/+14
2019-07-12PapiExecutor always verifiesVratko Polak1-31/+16
2019-05-31CSIT-1468: InterfaceUtil migration from VAT to PAPIJan Gelety1-10/+7
2019-04-01CSIT-1337: Migrate L2Util library from VAT to PAPIJan Gelety1-172/+252
2019-01-10VPP_Device - add baseline tests - part IIa)Jan Gelety1-1/+1
2018-10-10Add VXLAN scale perf testsJan Gelety1-2/+2
2018-07-18CSIT-1201 Create L2patch perf testsPeter Mikus1-0/+30
2018-05-04Fix various pylint 1.5.4 warningsVratko Polak1-1/+0
2018-04-25Fix warnings reported by gen_doc.shVratko Polak1-15/+16
2017-10-11CSIT-778: Add mac-ip binding acl l2bd perf testJan Gelety1-0/+26
2016-09-05CSIT-229: ip4-lispgpe-ip4Tibor Frank1-29/+0
2016-07-27CSIT-271: FIX Delete bridge after TAP testMatej Klotton1-5/+16
2016-07-22CSIT-158: Tap interface testsZdeno Olsovsky1-0/+2
2016-07-19CSIT-34: VLAN tag rewrite translate tests with x-connects - IPv4Jan Gelety1-10/+20
2016-06-23Add tests for Honeycomb L2 FIB supportTibor Frank1-0/+75
2016-06-074 Vhosts setup testZdeno Olsovsky1-5/+41
2016-04-26Add qinq through xconnect tests.Patrik Hrnciar1-0/+23
2016-04-22Reformat python libraries.Matej Klotton1-26/+29
2016-04-13Add keywords for Honeycomb testsselias1-0/+27
2016-03-30Add linux_add/del_bridge and modify vpp_add_l2fib_entryMatus Fabian1-4/+39
2016-03-14Add vxlan tests using xconnectPatrik Hrnciar1-6/+15
2016-03-07Add with-statment support to VatTerminal.Matej Klotton1-8/+7
2016-03-02Transfer l2_xconnect setup to L2UtilPatrik Hrnciar1-1/+23
2016-02-29Add VXLAN testMatej Klotton1-41/+58
2016-02-18Bridge Domain tests updateMatus Fabian1-15/+34
2016-02-11Update of latest tests.Stefan Kobza1-0/+119
>ip4.address else: return self.ip_addr.packed == other.ip6.address else: raise Exception("Comparing VppIpAddresUnions:%s" " with unknown type: %s" % (self, other)) return False class VppIpAddress(): def __init__(self, addr): self.addr = VppIpAddressUnion(addr) def encode(self): if self.addr.version is 6: return { 'af': VppEnum.vl_api_address_family_t.ADDRESS_IP6, 'un': self.addr.encode() } else: return { 'af': VppEnum.vl_api_address_family_t.ADDRESS_IP4, 'un': self.addr.encode() } def __eq__(self, other): if isinstance(other, self.__class__): return self.addr == other.addr elif hasattr(other, "af") and hasattr(other, "un"): # a vp_api_address_t if 4 is self.version: return other.af == \ VppEnum.vl_api_address_family_t.ADDRESS_IP4 and \ other.un == self.addr else: return other.af == \ VppEnum.vl_api_address_family_t.ADDRESS_IP6 and \ other.un == self.addr else: raise Exception("Comparing VppIpAddress:%s with unknown type: %s" % (self, other)) return False def __ne__(self, other): return not (self == other) def __str__(self): return self.address @property def bytes(self): return self.addr.bytes @property def address(self): return self.addr.address @property def length(self): return self.addr.length @property def version(self): return self.addr.version @property def is_ip6(self): return (self.version == 6) @property def af(self): if self.version == 6: return AF_INET6 else: return AF_INET @property def dpo_proto(self): if self.version is 6: return DpoProto.DPO_PROTO_IP6 else: return DpoProto.DPO_PROTO_IP4 class VppIpPrefix(): def __init__(self, addr, len): self.addr = VppIpAddress(addr) self.len = len def __eq__(self, other): if self.addr == other.addr and self.len == other.len: return True return False def encode(self): return {'address': self.addr.encode(), 'address_length': self.len} @property def address(self): return self.addr.address @property def length(self): return self.len def __str__(self): return "%s/%d" % (self.address, self.length) def __eq__(self, other): if isinstance(other, self.__class__): return (self.len == other.len and self.addr == other.addr) elif hasattr(other, "address") and hasattr(other, "address_length"): # vl_api_prefix_t return self.len == other.address_length and \ self.addr == other.address else: raise Exception("Comparing VppIpPrefix:%s with unknown type: %s" % (self, other)) return False class VppIpMPrefix(): def __init__(self, saddr, gaddr, len): self.saddr = saddr self.gaddr = gaddr self.len = len self.ip_saddr = ip_address(unicode(self.saddr)) self.ip_gaddr = ip_address(unicode(self.gaddr)) def encode(self): if 6 is self.ip_saddr.version: prefix = { 'af': VppEnum.vl_api_address_family_t.ADDRESS_IP6, 'grp_address': { 'ip6': { 'address': self.ip_gaddr.packed }, }, 'src_address': { 'ip6': { 'address': self.ip_saddr.packed }, }, 'grp_address_length': self.len, } else: prefix = { 'af': VppEnum.vl_api_address_family_t.ADDRESS_IP4, 'grp_address': { 'ip4': { 'address': self.ip_gaddr.packed }, }, 'src_address': { 'ip4': { 'address': self.ip_saddr.packed }, }, 'grp_address_length': self.len, } return prefix