Commit 69dc78bc authored by David Johnson's avatar David Johnson

Fix Seg6Action to use only the 'encap' kwarg, a dict that pyroute2 accepts.

parent b7f3a243
Pipeline #3030 passed with stages
in 15 seconds
......@@ -166,30 +166,37 @@ class Seg6Action(RouteAction):
DB_KEYS = RouteAction.DB_KEYS
NL_KEYS = RouteAction.NL_KEYS
def __init__(self,number=None,dst=None,dst_len=None,gateway=None,oif=None,
if not mode in ["inline","encap","l2encap"]:
raise Exception("invalid seg6 mode")
if segments is None or len(segments) < 1:
raise Exception("no seg6 tunnel segments supplied")
if not encap:
encap = {}
if 'mode' in encap \
and not encap['mode'] in ["inline","encap","l2encap"]:
raise Exception("invalid seg6 encap[mode]")
encap['mode'] = 'encap'
if not 'segs' in encap or encap['segs'] is None or len(encap['segs']) < 1:
raise Exception("no seg6 tunnel segs supplied")
if 'type' in encap and encap['type'] != 'seg6':
raise Exception("only encap[type] == seg6 supported")
if not 'type' in encap:
encap['type'] = 'seg6'
super(Seg6Action, self).__init__(
self.mode = mode
self.segments = segments
self.keyid = keyid
self.encap = encap
def type(self):
return "seg6"
def __repr__(self):
return "Seg6Action(%s,%s/%s,%s,%s,%s,%s)" \
return "Seg6Action(%s,%s/%s,%s,%s)" \
% (str(self.number),str(self.dst),str(self.dst_len),str(self.oif),
class MultiAction(Action):
def __init__(self,number=None):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment