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

Function GetAction

extras/packetforge/packetforge.py:79–128  ·  view source on GitHub ↗
(actions, flow)

Source from the content-addressed store, hash-verified

77
78
79def GetAction(actions, flow):
80 if len(actions.split(" ")) > 1:
81 type = actions.split(" ")[0]
82 else:
83 type = actions
84
85 if type == "mark":
86 flow.update(
87 {
88 "actions": VppEnum.vl_api_flow_action_v2_t.FLOW_ACTION_MARK_V2,
89 "mark_flow_id": int(actions.split(" ")[1]),
90 }
91 )
92 elif type == "next-node":
93 flow.update(
94 {
95 "actions": VppEnum.vl_api_flow_action_v2_t.FLOW_ACTION_REDIRECT_TO_NODE_V2,
96 "redirect_node_index": int(actions.split(" ")[1]),
97 }
98 )
99 elif type == "buffer-advance":
100 flow.update(
101 {
102 "actions": VppEnum.vl_api_flow_action_v2_t.FLOW_ACTION_BUFFER_ADVANCE_V2,
103 "buffer_advance": int(actions.split(" ")[1]),
104 }
105 )
106 elif type == "redirect-to-queue":
107 flow.update(
108 {
109 "actions": VppEnum.vl_api_flow_action_v2_t.FLOW_ACTION_REDIRECT_TO_QUEUE_V2,
110 "redirect_queue": int(actions.split(" ")[1]),
111 }
112 )
113 elif type == "rss":
114 flow.update({"actions": VppEnum.vl_api_flow_action_v2_t.FLOW_ACTION_RSS_V2})
115 elif type == "rss-queues":
116 queue_end = int(actions.split(" ")[-1])
117 queue_start = int(actions.split(" ")[-3])
118 flow.update(
119 {
120 "actions": VppEnum.vl_api_flow_action_v2_t.FLOW_ACTION_RSS_V2,
121 "queue_index": queue_start,
122 "queue_num": queue_end - queue_start + 1,
123 }
124 )
125 elif type == "drop":
126 flow.update({"actions": VppEnum.vl_api_flow_action_v2_t.FLOW_ACTION_DROP_V2})
127
128 return flow
129
130
131def GetBinary(flow_info):

Callers 1

ForgeFunction · 0.85

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected