MCPcopy Create free account
hub / github.com/FDio/vpp / ParseFields

Function ParseFields

extras/packetforge/packetforge.py:137–149  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

135
136
137def ParseFields(item):
138 # get protocol name
139 prot = item.split("(")[0]
140 stack = {"header": prot}
141 # get fields contents
142 fields = re.findall(r"[(](.*?)[)]", item)
143 if not fields:
144 print("error: invalid pattern")
145 return None
146 if fields == [""]:
147 return stack
148 stack.update({"fields": []})
149 return ParseStack(stack, fields[0].split(","))
150
151
152def GetMask(item):

Callers 1

ParsePatternFunction · 0.85

Calls 3

printFunction · 0.85
ParseStackFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected