Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Improve PLRsearch yet again
[csit.git]
/
resources
/
libraries
/
python
/
TestConfig.py
diff --git
a/resources/libraries/python/TestConfig.py
b/resources/libraries/python/TestConfig.py
index
98e1818
..
48f67e5
100644
(file)
--- a/
resources/libraries/python/TestConfig.py
+++ b/
resources/libraries/python/TestConfig.py
@@
-17,7
+17,8
@@
from ipaddress import ip_address, AddressValueError
from robot.api import logger
from resources.libraries.python.Constants import Constants
from robot.api import logger
from resources.libraries.python.Constants import Constants
-from resources.libraries.python.InterfaceUtil import InterfaceUtil
+from resources.libraries.python.InterfaceUtil import InterfaceUtil, \
+ InterfaceStatusFlags
from resources.libraries.python.IPUtil import IPUtil
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
from resources.libraries.python.topology import Topology
from resources.libraries.python.IPUtil import IPUtil
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
from resources.libraries.python.topology import Topology
@@
-145,11
+146,10
@@
class TestConfig(object):
cmd1 = 'sw_interface_add_del_address'
args1 = dict(
sw_if_index=InterfaceUtil.get_interface_index(node, node_vxlan_if),
cmd1 = 'sw_interface_add_del_address'
args1 = dict(
sw_if_index=InterfaceUtil.get_interface_index(node, node_vxlan_if),
- is_add=1,
- is_ipv6=1 if src_ip_addr_start.version == 6 else 0,
- del_all=0,
- address_length=128 if src_ip_addr_start.version == 6 else 32,
- address=None)
+ is_add=True,
+ del_all=False,
+ prefix=None
+ )
cmd2 = 'vxlan_add_del_tunnel'
args2 = dict(
is_add=1,
cmd2 = 'vxlan_add_del_tunnel'
args2 = dict(
is_add=1,
@@
-160,14
+160,14
@@
class TestConfig(object):
mcast_sw_if_index=Constants.BITWISE_NON_ZERO,
encap_vrf_id=0,
decap_next_index=Constants.BITWISE_NON_ZERO,
mcast_sw_if_index=Constants.BITWISE_NON_ZERO,
encap_vrf_id=0,
decap_next_index=Constants.BITWISE_NON_ZERO,
- vni=None)
+ vni=None
+ )
cmd3 = 'create_vlan_subif'
args3 = dict(
sw_if_index=InterfaceUtil.get_interface_index(
node, node_vlan_if),
cmd3 = 'create_vlan_subif'
args3 = dict(
sw_if_index=InterfaceUtil.get_interface_index(
node, node_vlan_if),
- vlan_id=None)
- err_msg = 'Failed to create VXLAN and VLAN interfaces on host {host}'.\
- format(host=node['host'])
+ vlan_id=None
+ )
with PapiSocketExecutor(node) as papi_exec:
for i in xrange(0, vxlan_count):
with PapiSocketExecutor(node) as papi_exec:
for i in xrange(0, vxlan_count):
@@
-179,7
+179,8
@@
class TestConfig(object):
"has been reached.")
vxlan_count = i
break
"has been reached.")
vxlan_count = i
break
- args1['address'] = getattr(src_ip, 'packed')
+ args1['prefix'] = IPUtil.create_prefix_object(
+ src_ip, 128 if src_ip_addr_start.version == 6 else 32)
args2['src_address'] = getattr(src_ip, 'packed')
args2['dst_address'] = getattr(dst_ip, 'packed')
args2['vni'] = int(vni_start) + i
args2['src_address'] = getattr(src_ip, 'packed')
args2['dst_address'] = getattr(dst_ip, 'packed')
args2['vni'] = int(vni_start) + i
@@
-188,8
+189,6
@@
class TestConfig(object):
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()
return vxlan_count
papi_exec.get_replies()
return vxlan_count
@@
-254,12
+253,12
@@
class TestConfig(object):
cmd = 'sw_interface_set_flags'
args1 = dict(
sw_if_index=None,
cmd = 'sw_interface_set_flags'
args1 = dict(
sw_if_index=None,
- admin_up_down=1)
+ flags=InterfaceStatusFlags.IF_STATUS_API_FLAG_ADMIN_UP.value
+ )
args2 = dict(
sw_if_index=None,
args2 = dict(
sw_if_index=None,
- admin_up_down=1)
- err_msg = 'Failed to put VXLAN and VLAN interfaces up on host {host}'. \
- format(host=node['host'])
+ flags=InterfaceStatusFlags.IF_STATUS_API_FLAG_ADMIN_UP.value
+ )
with PapiSocketExecutor(node) as papi_exec:
for i in xrange(0, vxlan_count):
with PapiSocketExecutor(node) as papi_exec:
for i in xrange(0, vxlan_count):
@@
-296,8
+295,6
@@
class TestConfig(object):
history = False if 1 < i < vxlan_count else True
papi_exec.add(cmd, history=history, **args1). \
add(cmd, history=history, **args2)
history = False if 1 < i < vxlan_count else True
papi_exec.add(cmd, history=history, **args1). \
add(cmd, history=history, **args2)
- if i > 0 and i % (Constants.PAPI_MAX_API_BULK / 2) == 0:
- papi_exec.get_replies(err_msg)
papi_exec.add(cmd, **args1).add(cmd, **args2)
papi_exec.get_replies()
papi_exec.add(cmd, **args1).add(cmd, **args2)
papi_exec.get_replies()
@@
-398,8
+395,6
@@
class TestConfig(object):
shg=0,
port_type=0,
enable=1)
shg=0,
port_type=0,
enable=1)
- err_msg = 'Failed to put VXLAN and VLAN interfaces to bridge domain ' \
- 'on host {host}'.format(host=node['host'])
with PapiSocketExecutor(node) as papi_exec:
for i in xrange(0, vxlan_count):
with PapiSocketExecutor(node) as papi_exec:
for i in xrange(0, vxlan_count):
@@
-420,6
+415,4
@@
class TestConfig(object):
add(cmd2, history=history, **args2). \
add(cmd3, history=history, **args3). \
add(cmd3, history=history, **args4)
add(cmd2, history=history, **args2). \
add(cmd3, history=history, **args3). \
add(cmd3, history=history, **args4)
- if i > 0 and i % (Constants.PAPI_MAX_API_BULK / 4) == 0:
- papi_exec.get_replies(err_msg)
papi_exec.get_replies()
papi_exec.get_replies()