Because:
>>> for i in xrange(4):
... if i > 0 and i % 250 / 3 == 0:
... i
...
1
2
Change-Id: Ia4eba227ea1e4c6222f32ac598f254428d95adc9
Signed-off-by: Peter Mikus <pmikus@cisco.com>
from enum import Enum, IntEnum
from ipaddress import ip_network, ip_address
from enum import Enum, IntEnum
from ipaddress import ip_network, ip_address
-from resources.libraries.python.Constants import Constants
from resources.libraries.python.IPUtil import IPUtil
from resources.libraries.python.InterfaceUtil import InterfaceUtil
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
from resources.libraries.python.IPUtil import IPUtil
from resources.libraries.python.InterfaceUtil import InterfaceUtil
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
if tunnel_src and tunnel_dst else dst_addr
history = False if 1 < i < n_entries - 1 else True
papi_exec.add(cmd, history=history, **args)
if tunnel_src and tunnel_dst else dst_addr
history = False if 1 < i < n_entries - 1 else True
papi_exec.add(cmd, history=history, **args)
- if i > 0 and i % Constants.PAPI_MAX_API_BULK == 0:
- papi_exec.get_replies(err_msg)
papi_exec.get_replies(err_msg)
@staticmethod
papi_exec.get_replies(err_msg)
@staticmethod
history = False if 1 < i < n_tunnels - 1 else True
papi_exec.add(cmd1, history=history, **args1).\
add(cmd2, history=history, **args2)
history = False if 1 < i < n_tunnels - 1 else True
papi_exec.add(cmd1, history=history, **args1).\
add(cmd2, history=history, **args2)
- if i > 0 and i % Constants.PAPI_MAX_API_BULK / 2 == 0:
- papi_exec.get_replies(err_msg)
papi_exec.get_replies(err_msg)
@staticmethod
papi_exec.get_replies(err_msg)
@staticmethod
raddr_s=raddr_s,
raddr_e=raddr_e))
tmp_file.write(tunnel)
raddr_s=raddr_s,
raddr_e=raddr_e))
tmp_file.write(tunnel)
- vat = VatExecutor()
- vat.execute_script(tmp_filename, node, timeout=300, json_out=False,
- copy_on_execute=True)
+ VatExecutor().execute_script(
+ tmp_filename, node, timeout=300, json_out=False,
+ copy_on_execute=True)
os.remove(tmp_filename)
return
os.remove(tmp_filename)
return
IPUtil.union_addr(raddr_ip + i)
history = False if 1 < i < n_entries - 1 else True
papi_exec.add(cmd, history=history, **args)
IPUtil.union_addr(raddr_ip + i)
history = False if 1 < i < n_entries - 1 else True
papi_exec.add(cmd, history=history, **args)
- if i > 0 and i % Constants.PAPI_MAX_API_BULK == 0:
- papi_exec.get_replies(err_msg)
papi_exec.get_replies(err_msg)
@staticmethod
papi_exec.get_replies(err_msg)
@staticmethod
addr_incr = 1 << (128 - raddr_range) if if1_ip.version == 6 \
else 1 << (32 - raddr_range)
addr_incr = 1 << (128 - raddr_range) if if1_ip.version == 6 \
else 1 << (32 - raddr_range)
tmp_fn1 = '/tmp/ipsec_create_tunnel_dut1.config'
tmp_fn2 = '/tmp/ipsec_create_tunnel_dut2.config'
vat = VatExecutor()
tmp_fn1 = '/tmp/ipsec_create_tunnel_dut1.config'
tmp_fn2 = '/tmp/ipsec_create_tunnel_dut2.config'
vat = VatExecutor()
history = False if 1 < i < n_tunnels - 1 else True
papi_exec.add(cmd1, history=history, **args1).\
add(cmd2, history=history, **args2)
history = False if 1 < i < n_tunnels - 1 else True
papi_exec.add(cmd1, history=history, **args1).\
add(cmd2, history=history, **args2)
- if i > 0 and i % Constants.PAPI_MAX_API_BULK / 2 == 0:
- replies = papi_exec.get_replies(err_msg)
- for reply in replies:
- if 'sw_if_index' in reply:
- ipsec_tunnels.append(reply["sw_if_index"])
replies = papi_exec.get_replies(err_msg)
for reply in replies:
if 'sw_if_index' in reply:
replies = papi_exec.get_replies(err_msg)
for reply in replies:
if 'sw_if_index' in reply:
papi_exec.add(cmd1, history=history, **args1).\
add(cmd2, history=history, **args2).\
add(cmd3, history=history, **args3)
papi_exec.add(cmd1, history=history, **args1).\
add(cmd2, history=history, **args2).\
add(cmd3, history=history, **args3)
- if i > 0 and i % Constants.PAPI_MAX_API_BULK / 3 == 0:
- papi_exec.get_replies(err_msg)
papi_exec.get_replies(err_msg)
with PapiSocketExecutor(nodes['DUT2']) as papi_exec:
papi_exec.get_replies(err_msg)
with PapiSocketExecutor(nodes['DUT2']) as papi_exec:
args2['remote_integ_key'] = ikeys[i]
history = False if 1 < i < n_tunnels - 1 else True
papi_exec.add(cmd2, history=history, **args2)
args2['remote_integ_key'] = ikeys[i]
history = False if 1 < i < n_tunnels - 1 else True
papi_exec.add(cmd2, history=history, **args2)
- if i > 0 and i % Constants.PAPI_MAX_API_BULK / 2 == 0:
- replies = papi_exec.get_replies(err_msg)
- for reply in replies:
- if 'sw_if_index' in reply:
- ipsec_tunnels.append(reply["sw_if_index"])
replies = papi_exec.get_replies(err_msg)
for reply in replies:
if 'sw_if_index' in reply:
replies = papi_exec.get_replies(err_msg)
for reply in replies:
if 'sw_if_index' in reply:
papi_exec.add(cmd1, history=history, **args1). \
add(cmd2, history=history, **args2). \
add(cmd3, history=history, **args3)
papi_exec.add(cmd1, history=history, **args1). \
add(cmd2, history=history, **args2). \
add(cmd3, history=history, **args3)
- if i > 0 and i % Constants.PAPI_MAX_API_BULK / 3 == 0:
- papi_exec.get_replies(err_msg)
papi_exec.get_replies(err_msg)
@staticmethod
papi_exec.get_replies(err_msg)
@staticmethod