'ip_punt_police': {'is_add': 1, },
'ip_punt_redirect': {'is_add': 1, },
'ip_route_add_del': {'is_add': 1, },
- 'ip_table_add_del': {'is_add': 1, },
'ip_unnumbered_dump': {'sw_if_index': 4294967295, },
'ipsec_interface_add_del_spd': {'is_add': 1, },
'ipsec_sad_entry_add_del': {'is_add': 1, },
self.hook.after_api(api_fn.__name__, api_args)
return reply
- def cli(self, cli):
+ def cli_return_response(self, cli):
""" Execute a CLI, calling the before/after hooks appropriately.
+ Return the reply without examining it
:param cli: CLI to execute
- :returns: CLI output
+ :returns: response object
"""
self.hook.before_cli(cli)
cli += '\n'
r = self.papi.cli_inband(cmd=cli)
self.hook.after_cli(cli)
+ return r
+
+ def cli(self, cli):
+ """ Execute a CLI, calling the before/after hooks appropriately.
+
+ :param cli: CLI to execute
+ :returns: CLI output
+
+ """
+ r = self.cli_return_response(cli)
if r.retval == -156:
raise CliSyntaxError(r.reply)
if r.retval != 0:
:param cli: CLI to execute
:returns: CLI output
"""
- return cli + "\n" + self.cli(cli).encode('ascii',
- errors='backslashreplace')
+ return cli + "\n" + self.cli(cli)
def want_ip4_arp_events(self, enable_disable=1, ip="0.0.0.0"):
return self.api(self.papi.want_ip4_arp_events,
return self.api(self.papi.create_loopback,
{'mac_address': mac})
- def ip_table_add_del(self,
- table_id,
- is_add=1,
- is_ipv6=0):
- """
-
- :param table_id
- :param is_add: (Default value = 1)
- :param is_ipv6: (Default value = 0)
-
- """
-
- return self.api(
- self.papi.ip_table_add_del,
- {'table':
- {
- 'table_id': table_id,
- 'is_ip6': is_ipv6
- },
- 'is_add': is_add})
-
- def ip_table_dump(self):
- return self.api(self.papi.ip_table_dump, {})
-
def ip_route_dump(self, table_id, is_ip6=False):
return self.api(self.papi.ip_route_dump,
{'table': {
:param current_data_flag: (Default value = 0)
:param current_data_offset: (Default value = 0)
"""
-
- mask_len = ((len(mask) - 1) / 16 + 1) * 16
- mask = mask + '\0' * (mask_len - len(mask))
+ mask_len = ((len(mask) - 1) // 16 + 1) * 16
+ mask = mask + b'\0' * (mask_len - len(mask))
return self.api(
self.papi.classify_add_del_table,
{'is_add': is_add,
:param metadata: (Default value = 0)
"""
- match_len = ((len(match) - 1) / 16 + 1) * 16
- match = match + '\0' * (match_len - len(match))
+ match_len = ((len(match) - 1) // 16 + 1) * 16
+ match = match + b'\0' * (match_len - len(match))
return self.api(
self.papi.classify_add_del_session,
{'is_add': is_add,
def vxlan_gbp_tunnel_dump(self, sw_if_index=0xffffffff):
return self.api(self.papi.vxlan_gbp_tunnel_dump,
- {'sw_if_index': sw_if_index,
- '_no_type_conversion': True})
+ {'sw_if_index': sw_if_index})
def pppoe_add_del_session(
self,
remote_crypto_key, integ_alg, local_integ_key,
remote_integ_key, is_add=1, esn=0, salt=0,
anti_replay=1, renumber=0,
- udp_encap=0, show_instance=0):
+ udp_encap=0, show_instance=0xffffffff):
return self.api(
self.papi.ipsec_tunnel_if_add_del,
{
def gbp_endpoint_dump(self):
""" GBP endpoint Dump """
- return self.api(self.papi.gbp_endpoint_dump,
- {'_no_type_conversion': True})
+ return self.api(self.papi.gbp_endpoint_dump, {})
def gbp_endpoint_group_add(self, vnid, sclass, bd,
rd, uplink_sw_if_index,
def gbp_subnet_dump(self):
""" GBP Subnet Dump """
- return self.api(self.papi.gbp_subnet_dump,
- {'_no_type_conversion': True})
+ return self.api(self.papi.gbp_subnet_dump, {})
def gbp_contract_dump(self):
""" GBP contract Dump """
'sw_if_index': sw_if_index,
'is_enable': is_enable,
})
+
+ def feature_gso_enable_disable(self, sw_if_index, enable_disable=1):
+ return self.api(self.papi.feature_gso_enable_disable,
+ {
+ 'sw_if_index': sw_if_index,
+ 'enable_disable': enable_disable,
+ })