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

Method resolveOptional

extras/packetforge/ProtocolHeader.py:86–128  ·  view source on GitHub ↗
(self, condition)

Source from the content-addressed store, hash-verified

84 return field.UpdateMask(expression)
85
86 def resolveOptional(self, condition):
87 if condition == None:
88 return True
89
90 tokens = condition.split("|")
91
92 if len(tokens) > 1:
93 result = False
94
95 for token in tokens:
96 result |= self.resolveOptional(token)
97
98 return result
99
100 tokens = condition.split("&")
101
102 if len(tokens) > 1:
103 result = True
104
105 for token in tokens:
106 result &= self.resolveOptional(token)
107
108 return result
109
110 key = None
111 value = None
112
113 if "!=" in tokens[0]:
114 index = tokens[0].find("!=")
115 key = tokens[0][:index].strip()
116 value = tokens[0][index + 1 :].strip()
117 elif "=" in tokens[0]:
118 index = tokens[0].find("=")
119 key = tokens[0][:index].strip()
120 value = tokens[0][index + 1 :].strip()
121 else:
122 return False
123
124 if key not in self.fieldDict:
125 return False
126
127 f = self.fieldDict[key]
128 return ExpressionConverter.Equal(f.Value, value)
129
130 def resolveSize(self, exp):
131 shift = 0

Callers 2

AdjustMethod · 0.95
resolveAllSizeMethod · 0.95

Calls 1

findMethod · 0.45

Tested by

no test coverage detected