aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_papi_provider.py
AgeCommit message (Expand)AuthorFilesLines
2017-10-19Remove unused 'not_last' parameter from ip_add_del_routeMarek Gradzki1-7/+2
2017-10-14Source Lookup progammable via APINeale Ranns1-0/+4
2017-10-10punt and drop features:Neale Ranns1-0/+57
2017-10-06Initial GENEVE TUNNEL implementation and tests.Marco Varlese1-0/+32
2017-10-05Distributed Virtual Router SupportNeale Ranns1-0/+2
2017-10-02L2-FIB:add mac learn events testEyal Bari1-0/+9
2017-09-27acl-plugin: take 2 at VPP-991 fix, this time with a test case which verifies it.Andrew Yourtchenko1-0/+10
2017-09-26acl-plugin: test: move the API calls to vpp_papi_provider.pyAndrew Yourtchenko1-0/+29
2017-09-22IP-MAC,ND:wildcard events,fix sending multiple eventsEyal Bari1-0/+6
2017-09-18L2BD,ARP-TERM:fix arp query report mechanism+testEyal Bari1-3/+9
2017-09-12ACL-plugin add "replace" semantics for adding a new MacIP aclPavel Kotucek1-6/+14
2017-09-11FIB table add/delete APINeale Ranns1-12/+34
2017-09-08ACL-plugin MACIP ACLs testsPavel Kotucek1-0/+55
2017-09-06NAT: Destination NAT44 with load-balancing (VPP-954)Matus Fabian1-0/+30
2017-08-23NAT: Rename snat plugin to nat (VPP-955)Matus Fabian1-100/+87
2017-08-22SRv6 testsKris Michielsen1-0/+118
2017-08-16SNAT: Make proto optional in nat64_bib_dump (VPP-942)Matus Fabian1-4/+4
2017-08-11Dedicated SW Interface EventNeale Ranns1-7/+2
2017-08-09Add PPPoE PluginHongjun Ni1-0/+26
2017-08-08L2 over MPLSNeale Ranns1-2/+2
2017-08-01P2P EthernetPavel Kotucek1-0/+25
2017-07-24SPAN:add l2 mirrorEyal Bari1-2/+5
2017-07-20SNAT: in2out translation as an output feature (VPP-903)Matus Fabian1-0/+23
2017-07-18DHCP client option 61 "client_id"Neale Ranns1-0/+2
2017-07-18DHCP client - remove interface address when DHCP de-configuredNeale Ranns1-0/+15
2017-07-04TEST:add L2BD arp term testsEyal Bari1-0/+8
2017-06-21NAT64: custom prefixMatus Fabian1-5/+27
2017-06-21L2-VTR: add vtr testsEyal Bari1-0/+8
2017-06-08NAT64: Add NAT64 support for snat plugin (VPP-699)Matus Fabian1-0/+118
2017-06-06Rework vxlan-gpe to support FIB 2.0 and bypass modeHongjun Ni1-0/+35
2017-05-16L2FIB: add flush testEyal Bari1-0/+21
2017-05-15Add GTP-U plugin. VPP-694Hongjun Ni1-0/+32
2017-04-26IP Flow Hash Config fixesNeale Ranns1-0/+19
2017-04-26CGN: Session dump, test naming for ports fixedMartin Gálik1-0/+15
2017-04-26CGNAT: close session API and CLI commands.Martin Gálik1-0/+46
2017-04-12CGN: configurable timeoutsMatus Fabian1-0/+27
2017-04-07MPLS McastNeale Ranns1-2/+14
2017-04-06BFD-FIB interactionsNeale Ranns1-2/+3
2017-03-15Python API: Change from cPython to CFFI.Ole Troan1-1/+1
2017-03-09IMplementation for option to not create a FIB table entry when adding a neigh...Neale Ranns1-0/+3
2017-03-09MAP pre-resolve - use FIB to track pre-resolved next-hopNeale Ranns1-0/+28
2017-03-08SNAT: deterministic map dumpMartin1-0/+7
2017-03-08SNAT: user_session_dump is_ip4 and vat unformating addedMartin1-2/+4
2017-03-08Proxy ND (RFC4389 - or a sub-set thereof). This allows the 'emulation' of bri...Neale Ranns1-0/+6
2017-03-07CGN: Deterministic NAT (VPP-623)Matus Fabian1-0/+48
2017-03-07Add setting of tenant VRF id for SNAT addresses (VPP-641)Juraj Sloboda1-1/+4
2017-03-03IPv6 RA improvementsNeale Ranns1-0/+25
2017-03-03python API: work towards python/vpp api separationKlement Sekera1-6/+6
2017-03-02SNAT: user's dump and session dump of a certain snat user.magalik1-0/+23
2017-03-02Remove the unused VRF ID parameter from the IP neighbour Add/Del APINeale Ranns1-4/+1
">field.UpdateMask(expression) def resolveOptional(self, condition): if condition == None: return True tokens = condition.split("|") if len(tokens) > 1: result = False for token in tokens: result |= self.resolveOptional(token) return result tokens = condition.split("&") if len(tokens) > 1: result = True for token in tokens: result &= self.resolveOptional(token) return result key = None value = None if "!=" in tokens[0]: index = tokens[0].find("!=") key = tokens[0][:index].strip() value = tokens[0][index + 1 :].strip() elif "=" in tokens[0]: index = tokens[0].find("=") key = tokens[0][:index].strip() value = tokens[0][index + 1 :].strip() else: return False if key not in self.fieldDict: return False f = self.fieldDict[key] return ExpressionConverter.Equal(f.Value, value) def resolveSize(self, exp): shift = 0 key = exp if "<<" in exp: offset = exp.find("<<") key = exp[0:offset].strip() shift = int(exp[offset + 2 :].strip()) if self.fieldDict.has_key(key): field = self.fieldDict[key] _, u16 = ExpressionConverter.ToNum(field.Value) if u16: return u16 << shift else: return 0 if self.attributeDict.has_key(key): attr = self.attributeDict[key] _, u16 = ExpressionConverter.ToNum(attr.Value) if u16: return u16 << shift else: return 0 return 0 def Adjust(self): autoIncreases = [] increaseHeaders = [] self.resolveAllSize() for phf in self.fields: if phf.Field.IsAutoIncrease: autoIncreases.append(phf) if phf.Field.IsIncreaseLength and self.resolveOptional(phf.Field.Optional): increaseHeaders.append(phf) for f1 in autoIncreases: for f2 in increaseHeaders: f1.UpdateValue( ExpressionConverter.IncreaseValue(f1.Value, f2.Size >> 3), True ) def resolveAllSize(self): for phf in self.fields: if phf.Field.Optional != None and not self.resolveOptional( phf.Field.Optional ): size = 0 else: if phf.Field.VariableSize != None: size = self.resolveSize(phf.Field.VariableSize) else: size = phf.Field.Size phf.Size = size def GetSize(self): size = 0 for field in self.fields: size += field.Size return size >> 3 def AppendAuto(self, size): for phf in self.fields: if not phf.Field.IsAutoIncrease: continue phf.UpdateValue(ExpressionConverter.IncreaseValue(phf.Value, size), True) def getField(self, name): if not self.fieldDict.has_key(name): return None field = self.fieldDict[name] return field.Value def getAttribute(self, name): if not self.attributeDict.has_key(name): return None return self.attributeDict[name].Value def GetValue(self, name): result = self.getField(name) if result == None: return self.getAttribute(name) return result def appendNum(self, big, exp, size): num = 0 if exp != None: _, num = ExpressionConverter.ToNum(exp) if num == None: print("Invalid byte expression") return None # cut msb num = num & ((1 << size) - 1) big = big << size big = big | num return big def appendUInt64(self, big, exp, size): u64 = 0 if exp != None: _, u64 = ExpressionConverter.ToNum(exp) if not u64: print("Invalid UInt32 expression") return False # cut msb if size < 64: u64 = u64 & ((1 << size) - 1) big = big << size big = big | u64 return big def appendIPv4(self, big, exp): ipv4 = bytes(4) if exp != None: _, ipv4 = ExpressionConverter.ToIPv4Address(exp) if not ipv4: print("Inavalid IPv4 Address") return False for i in range(len(ipv4)): big = big << 8 big = big | ipv4[i] return big def appendIPv6(self, big, exp): ipv6 = bytes(16) if exp != None: _, ipv6 = ExpressionConverter.ToIPv6Address(exp) if not ipv6: print("Inavalid IPv6 Address") return False for i in range(16): big = big << 8 big = big | ipv6[i] return big def appendMAC(self, big, exp): mac = bytes(6) if exp != None: _, mac = ExpressionConverter.ToMacAddress(exp) if not mac: print("Inavalid MAC Address") return False for i in range(6): big = big << 8 big = big | mac[i] return big def appendByteArray(self, big, exp, size): array = bytes(size >> 3) if exp != None: _, array = ExpressionConverter.ToByteArray(exp) if not array: print("Invalid byte array") return False for i in range(size >> 3): big = big << 8 if i < len(array): big = big | array[i] return big def append(self, big, phf): bigVal = big["bigVal"] bigMsk = big["bigMsk"] if phf.Field.IsReserved: bigVal <<= phf.Size bigMsk <<= phf.Size big.update(bigVal=bigVal, bigMsk=bigMsk) return big, phf.Size size = phf.Size if ( phf.Field.Format == InputFormat.u8 or phf.Field.Format == InputFormat.u16 or phf.Field.Format == InputFormat.u32 ): bigVal = self.appendNum(bigVal, phf.Value, size) bigMsk = self.appendNum(bigMsk, phf.Mask, size) elif phf.Field.Format == InputFormat.u64: bigVal = self.appendUInt64(bigVal, phf.Value, size) bigMsk = self.appendUInt64(bigMsk, phf.Mask, size) elif phf.Field.Format == InputFormat.ipv4: bigVal = self.appendIPv4(bigVal, phf.Value) bigMsk = self.appendIPv4(bigMsk, phf.Mask) elif phf.Field.Format == InputFormat.ipv6: bigVal = self.appendIPv6(bigVal, phf.Value) bigMsk = self.appendIPv6(bigMsk, phf.Mask) elif phf.Field.Format == InputFormat.mac: bigVal = self.appendMAC(bigVal, phf.Value) bigMsk = self.appendMAC(bigMsk, phf.Mask) elif phf.Field.Format == InputFormat.bytearray: bigVal = self.appendByteArray(bigVal, phf.Value, size) bigMsk = self.appendByteArray(bigMsk, phf.Mask, size) else: print("Invalid input format") big.update(bigVal=bigVal, bigMsk=bigMsk) return big, size def Resolve(self): big = {"bigVal": 0, "bigMsk": 0} offset = 0 for phf in self.fields: if phf.Size == 0: continue big, bits = self.append(big, phf) offset += bits byteList1 = [] byteList2 = [] bigVal = big["bigVal"] bigMsk = big["bigMsk"] while offset > 0: byteList1.append(bigVal & 0xFF) byteList2.append(bigMsk & 0xFF) bigVal = bigVal >> 8 bigMsk = bigMsk >> 8 offset -= 8 byteList1.reverse() byteList2.reverse() buffer = copy.deepcopy(byteList1) mask = copy.deepcopy(byteList2) self.Buffer = buffer self.Mask = mask