- my bad
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: I8c1f57f6b648b99338f3f6a6ff9ec943082e9bc4
from resources.libraries.python.IPUtil import IPUtil
from resources.libraries.python.L2Util import L2Util
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
from resources.libraries.python.IPUtil import IPUtil
from resources.libraries.python.L2Util import L2Util
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
-from resources.libraries.python.topology import Topology
class GBPEndpointFlags(IntEnum):
class GBPEndpointFlags(IntEnum):
.format(node=node['host'])
args_in = dict(
.format(node=node['host'])
args_in = dict(
- rd = dict (
- rd_id = rd_id,
- ip4_table_id = ip4_table_id,
- ip6_table_id = ip6_table_id,
- ip4_uu_sw_if_index = ip4_uu_sw_if_index,
- ip6_uu_sw_if_index = ip6_uu_sw_if_index
+ rd=dict(
+ rd_id=rd_id,
+ ip4_table_id=ip4_table_id,
+ ip6_table_id=ip6_table_id,
+ ip4_uu_sw_if_index=ip4_uu_sw_if_index,
+ ip6_uu_sw_if_index=ip6_uu_sw_if_index
.format(node=node['host'])
args_in = dict(
.format(node=node['host'])
args_in = dict(
- bd = dict(
- flags = getattr(GBPBridgeDomainFlags,
- 'GBP_BD_API_FLAG_NONE').value,
- bvi_sw_if_index = bvi_sw_if_index,
- uu_fwd_sw_if_index = uu_fwd_sw_if_index,
- bm_flood_sw_if_index = bm_flood_sw_if_index,
- bd_id = bd_id,
- rd_id = rd_id
+ bd=dict(
+ flags=getattr(GBPBridgeDomainFlags,
+ 'GBP_BD_API_FLAG_NONE').value,
+ bvi_sw_if_index=bvi_sw_if_index,
+ uu_fwd_sw_if_index=uu_fwd_sw_if_index,
+ bm_flood_sw_if_index=bm_flood_sw_if_index,
+ bd_id=bd_id,
+ rd_id=rd_id
.format(node=node['host'])
args_in = dict(
.format(node=node['host'])
args_in = dict(
- epg = dict (
- uplink_sw_if_index = uplink_sw_if_index,
- bd_id = bd_id,
- rd_id = rd_id,
- vnid = vnid,
- sclass = sclass,
- retention = dict (
- remote_ep_timeout = remote_ep_timeout
+ epg=dict(
+ uplink_sw_if_index=uplink_sw_if_index,
+ bd_id=bd_id,
+ rd_id=rd_id,
+ vnid=vnid,
+ sclass=sclass,
+ retention=dict(
+ remote_ep_timeout=remote_ep_timeout
ip_address(unicode('0.0.0.0')))
args_in = dict(
ip_address(unicode('0.0.0.0')))
args_in = dict(
- endpoint = dict(
- sw_if_index = sw_if_index,
- ips = ips,
- n_ips = len(ips),
- mac = L2Util.mac_to_bin(mac_addr),
- sclass = sclass,
- flags = getattr(GBPEndpointFlags,
- 'GBP_API_ENDPOINT_FLAG_EXTERNAL').value,
- tun = dict(
- src = tun_src,
- dst = tun_dst
+ endpoint=dict(
+ sw_if_index=sw_if_index,
+ ips=ips,
+ n_ips=len(ips),
+ mac=L2Util.mac_to_bin(mac_addr),
+ sclass=sclass,
+ flags=getattr(GBPEndpointFlags,
+ 'GBP_API_ENDPOINT_FLAG_EXTERNAL').value,
+ tun=dict(
+ src=tun_src,
+ dst=tun_dst
.format(node=node['host'])
args_in = dict(
.format(node=node['host'])
args_in = dict(
- is_add = 1,
- ext_itf = dict(
- sw_if_index = sw_if_index,
- bd_id = bd_id,
- rd_id = rd_id,
- flags = getattr(GBPExtItfFlags,
- 'GBP_API_EXT_ITF_F_NONE').value
+ is_add=1,
+ ext_itf=dict(
+ sw_if_index=sw_if_index,
+ bd_id=bd_id,
+ rd_id=rd_id,
+ flags=getattr(GBPExtItfFlags,
+ 'GBP_API_EXT_ITF_F_NONE').value
.format(node=node['host'])
args_in = dict(
.format(node=node['host'])
args_in = dict(
- is_add = 1,
- subnet = dict(
- type = getattr(GBPSubnetType,
- 'GBP_API_SUBNET_L3_OUT').value,
- sw_if_index = sw_if_index,
- sclass = sclass,
- prefix = dict(
- address = IPUtil.create_ip_address_object(
+ is_add=1,
+ subnet=dict(
+ type=getattr(GBPSubnetType,
+ 'GBP_API_SUBNET_L3_OUT').value,
+ sw_if_index=sw_if_index,
+ sclass=sclass,
+ prefix=dict(
+ address=IPUtil.create_ip_address_object(
ip_address(unicode(address))),
ip_address(unicode(address))),
- len = int(subnet_length)
.format(node=node['host'])
rule_permit = dict(
.format(node=node['host'])
rule_permit = dict(
- action = getattr(GBPRuleAction,
- 'GBP_API_RULE_PERMIT').value,
- nh_set = dict(
- hash_mode = list(),
- n_nhs = 8,
- nhs = [dict()]*8,
+ action=getattr(GBPRuleAction,
+ 'GBP_API_RULE_PERMIT').value,
+ nh_set=dict(
+ hash_mode=list(),
+ n_nhs=8,
+ nhs=[dict()]*8,
)
)
rules = [rule_permit, rule_permit]
args_in = dict(
)
)
rules = [rule_permit, rule_permit]
args_in = dict(
- is_add = 1,
- contract = dict(
- acl_index = acl_index,
- sclass = sclass,
- dclass = dclass,
- n_rules = len(rules),
- rules = rules,
- n_ether_types = 16,
- allowed_ethertypes = [0x800, 0x86dd] + [0]*14
+ is_add=1,
+ contract=dict(
+ acl_index=acl_index,
+ sclass=sclass,
+ dclass=dclass,
+ n_rules=len(rules),
+ rules=rules,
+ n_ether_types=16,
+ allowed_ethertypes=[0x800, 0x86dd] + [0]*14
for bond in details:
data += ('{b}\n'.format(b=bond['interface_name'].rstrip('\x00')))
for bond in details:
data += ('{b}\n'.format(b=bond['interface_name'].rstrip('\x00')))
- data += (' mode: {m}\n'.format(m=LinkBondMode(
- bond['mode']).name.lower()))
- data += (' load balance: {lb}\n'.format(lb=LinkBondLoadBalance(
- bond['lb']).name.lower()))
+ data += (' mode: {m}\n'.format(m=bond['mode']).lower())
+ data += (' load balance: {lb}\n'.format(lb=bond['lb']).lower())
data += (' number of active slaves: {n}\n'.format(
n=bond['active_slaves']))
if verbose:
data += (' number of active slaves: {n}\n'.format(
n=bond['active_slaves']))
if verbose:
self._ssh_control_socket = None
self._local_vpp_socket = None
self._ssh_control_socket = None
self._local_vpp_socket = None
- @property
- def crc_checker(self):
+ def create_crc_checker(self):
"""Return the cached instance or create new one from directory.
It is assumed self.api_json_directory is set, as a class variable.
"""Return the cached instance or create new one from directory.
It is assumed self.api_json_directory is set, as a class variable.
cls.api_json_directory = tmp_dir + "/usr/share/vpp/api"
# Perform initial checks before .api.json files are gone,
# by accessing the property (which also creates its instance).
cls.api_json_directory = tmp_dir + "/usr/share/vpp/api"
# Perform initial checks before .api.json files are gone,
# by accessing the property (which also creates its instance).
+ self.create_crc_checker()
# When present locally, we finally can find the installation path.
package_path = glob.glob(tmp_dir + installed_papi_glob)[0]
# Package path has to be one level above the vpp_papi directory.
# When present locally, we finally can find the installation path.
package_path = glob.glob(tmp_dir + installed_papi_glob)[0]
# Package path has to be one level above the vpp_papi directory.
sw_if_index=InterfaceUtil.get_interface_index(
node, node_vlan_if),
vlan_id=None)
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'])
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):
args2 = dict(
sw_if_index=None,
admin_up_down=1)
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'])
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):
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):
interface index assigned to the interface by vpp for a given node.
:param node: The node topology dictionary.
interface index assigned to the interface by vpp for a given node.
:param node: The node topology dictionary.
- :param sw_if_index: sw_if_index of the link that a interface is connected to.
+ :param sw_if_index: sw_if_index of the link that a interface is
+ connected to.
:type node: dict
:type sw_if_index: int
:returns: Interface name of the interface connected to the given link.
:type node: dict
:type sw_if_index: int
:returns: Interface name of the interface connected to the given link.
# TODO: Read FDIO_VPP_DIR environment variable, or some other input,
# instead of using hardcoded relative path?
# TODO: Read FDIO_VPP_DIR environment variable, or some other input,
# instead of using hardcoded relative path?
-api_dir = op.normpath(op.join(
+API_DIR = op.normpath(op.join(
op.dirname(op.abspath(__file__)), "..", "..", "..", "..",
"build-root", "install-vpp-native", "vpp", "share", "vpp", "api"))
op.dirname(op.abspath(__file__)), "..", "..", "..", "..",
"build-root", "install-vpp-native", "vpp", "share", "vpp", "api"))
-checker = VppApiCrcChecker(api_dir)
+CHECKER = VppApiCrcChecker(API_DIR)
- checker.report_initial_conflicts(report_missing=True)
+ CHECKER.report_initial_conflicts(report_missing=True)
except RuntimeError as err:
sys.stderr.write("{err!r}\n".format(err=err))
sys.stderr.write(
except RuntimeError as err:
sys.stderr.write("{err!r}\n".format(err=err))
sys.stderr.write(