sr: srv6 API cleanup
Use consistent API types. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I3c348ad2fca8bb3d9a246af7a2aa9dc9c33f57c3 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
This commit is contained in:

committed by
Ole Trøan

parent
c2c1bfd9b7
commit
0938eba153
@ -925,127 +925,6 @@ class VppPapiProvider(object):
|
||||
return self.api(self.papi.sr_mpls_policy_del,
|
||||
{'bsid': bsid})
|
||||
|
||||
def sr_localsid_add_del(self,
|
||||
localsid,
|
||||
behavior,
|
||||
nh_addr4,
|
||||
nh_addr6,
|
||||
is_del=0,
|
||||
end_psp=0,
|
||||
sw_if_index=0xFFFFFFFF,
|
||||
vlan_index=0,
|
||||
fib_table=0,
|
||||
):
|
||||
""" Add/del IPv6 SR local-SID.
|
||||
|
||||
:param localsid:
|
||||
:param behavior: END=1; END.X=2; END.DX2=4; END.DX6=5;
|
||||
:param behavior: END.DX4=6; END.DT6=7; END.DT4=8
|
||||
:param nh_addr4:
|
||||
:param nh_addr6:
|
||||
:param is_del: (Default value = 0)
|
||||
:param end_psp: (Default value = 0)
|
||||
:param sw_if_index: (Default value = 0xFFFFFFFF)
|
||||
:param vlan_index: (Default value = 0)
|
||||
:param fib_table: (Default value = 0)
|
||||
"""
|
||||
return self.api(
|
||||
self.papi.sr_localsid_add_del,
|
||||
{'is_del': is_del,
|
||||
'localsid': localsid,
|
||||
'end_psp': end_psp,
|
||||
'behavior': behavior,
|
||||
'sw_if_index': sw_if_index,
|
||||
'vlan_index': vlan_index,
|
||||
'fib_table': fib_table,
|
||||
'nh_addr4': nh_addr4,
|
||||
'nh_addr6': nh_addr6
|
||||
}
|
||||
)
|
||||
|
||||
def sr_policy_add(
|
||||
self,
|
||||
bsid_addr,
|
||||
weight=1,
|
||||
is_encap=1,
|
||||
type=0,
|
||||
fib_table=0,
|
||||
n_segments=0,
|
||||
segments=[]):
|
||||
"""
|
||||
:param bsid_addr: bindingSID of the SR Policy
|
||||
:param weight: weight of the sid list. optional. (default: 1)
|
||||
:param is_encap: (bool) whether SR policy should Encap or SRH insert \
|
||||
(default: Encap)
|
||||
:param type: type/behavior of the SR policy. (default or spray) \
|
||||
(default: default)
|
||||
:param fib_table: VRF where to install the FIB entry for the BSID \
|
||||
(default: 0)
|
||||
:param n_segments: number of segments \
|
||||
(default: 0)
|
||||
:param segments: a vector of IPv6 address composing the segment list \
|
||||
(default: [])
|
||||
"""
|
||||
return self.api(
|
||||
self.papi.sr_policy_add,
|
||||
{'bsid_addr': bsid_addr,
|
||||
'weight': weight,
|
||||
'is_encap': is_encap,
|
||||
'type': type,
|
||||
'fib_table': fib_table,
|
||||
'n_segments': n_segments,
|
||||
'segments': segments
|
||||
}
|
||||
)
|
||||
|
||||
def sr_policy_del(
|
||||
self,
|
||||
bsid_addr,
|
||||
sr_policy_index=0):
|
||||
"""
|
||||
:param bsid: bindingSID of the SR Policy
|
||||
:param sr_policy_index: index of the sr policy (default: 0)
|
||||
"""
|
||||
return self.api(
|
||||
self.papi.sr_policy_del,
|
||||
{'bsid_addr': bsid_addr,
|
||||
'sr_policy_index': sr_policy_index
|
||||
})
|
||||
|
||||
def sr_steering_add_del(
|
||||
self,
|
||||
is_del,
|
||||
bsid_addr,
|
||||
sr_policy_index,
|
||||
table_id,
|
||||
prefix_addr,
|
||||
mask_width,
|
||||
sw_if_index,
|
||||
traffic_type):
|
||||
"""
|
||||
Steer traffic L2 and L3 traffic through a given SR policy
|
||||
|
||||
:param is_del: delete or add
|
||||
:param bsid_addr: bindingSID of the SR Policy (alt to sr_policy_index)
|
||||
:param sr_policy: is the index of the SR Policy (alt to bsid)
|
||||
:param table_id: is the VRF where to install the FIB entry for the BSID
|
||||
:param prefix_addr: is the IPv4/v6 address for L3 traffic type
|
||||
:param mask_width: is the mask for L3 traffic type
|
||||
:param sw_if_index: is the incoming interface for L2 traffic
|
||||
:param traffic_type: type of traffic (IPv4: 4, IPv6: 6, L2: 2)
|
||||
"""
|
||||
return self.api(
|
||||
self.papi.sr_steering_add_del,
|
||||
{'is_del': is_del,
|
||||
'bsid_addr': bsid_addr,
|
||||
'sr_policy_index': sr_policy_index,
|
||||
'table_id': table_id,
|
||||
'prefix_addr': prefix_addr,
|
||||
'mask_width': mask_width,
|
||||
'sw_if_index': sw_if_index,
|
||||
'traffic_type': traffic_type
|
||||
})
|
||||
|
||||
def acl_add_replace(self, acl_index, r, tag='',
|
||||
expected_retval=0):
|
||||
"""Add/replace an ACL
|
||||
|
Reference in New Issue
Block a user