Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
TB2 XL710 topology files
[csit.git]
/
resources
/
libraries
/
python
/
IPv4Setup.py
diff --git
a/resources/libraries/python/IPv4Setup.py
b/resources/libraries/python/IPv4Setup.py
index
5015410
..
0720e73
100644
(file)
--- a/
resources/libraries/python/IPv4Setup.py
+++ b/
resources/libraries/python/IPv4Setup.py
@@
-173,18
+173,18
@@
class Dut(IPv4Node):
# TODO: check return value
VatExecutor.cmd_from_template(self.node_info, script, **args)
# TODO: check return value
VatExecutor.cmd_from_template(self.node_info, script, **args)
- def set_arp(self, i
nterface
, ip_address, mac_address):
+ def set_arp(self, i
face_key
, ip_address, mac_address):
"""Set entry in ARP cache.
"""Set entry in ARP cache.
- :param i
nterface: Interface name
.
+ :param i
face_key: Interface key
.
:param ip_address: IP address.
:param mac_address: MAC address.
:param ip_address: IP address.
:param mac_address: MAC address.
- :type i
nterface
: str
+ :type i
face_key
: str
:type ip_address: str
:type mac_address: str
"""
self.exec_vat('add_ip_neighbor.vat',
:type ip_address: str
:type mac_address: str
"""
self.exec_vat('add_ip_neighbor.vat',
- sw_if_index=self.get_sw_if_index(i
nterface
),
+ sw_if_index=self.get_sw_if_index(i
face_key
),
ip_address=ip_address, mac_address=mac_address)
def set_ip(self, interface, address, prefix_length):
ip_address=ip_address, mac_address=mac_address)
def set_ip(self, interface, address, prefix_length):
@@
-192,10
+192,10
@@
class Dut(IPv4Node):
sw_if_index=self.get_sw_if_index(interface),
address=address, prefix_length=prefix_length)
sw_if_index=self.get_sw_if_index(interface),
address=address, prefix_length=prefix_length)
- def set_route(self, network, prefix_length, gateway, interface):
+ def set_route(self, network, prefix_length, gateway, interface
, count=1
):
Routing.vpp_route_add(self.node_info,
network=network, prefix_len=prefix_length,
Routing.vpp_route_add(self.node_info,
network=network, prefix_len=prefix_length,
- gateway=gateway, interface=interface)
+ gateway=gateway, interface=interface
, count=count
)
def unset_route(self, network, prefix_length, gateway, interface):
self.exec_vat('del_route.vat', network=network,
def unset_route(self, network, prefix_length, gateway, interface):
self.exec_vat('del_route.vat', network=network,
@@
-255,7
+255,8
@@
class IPv4Setup(object):
continue
if node['type'] != NodeType.DUT:
continue
continue
if node['type'] != NodeType.DUT:
continue
- get_node(node).set_ip(port['if'], port['addr'], net['prefix'])
+ iface_key = topo.get_interface_by_name(node, port['if'])
+ get_node(node).set_ip(iface_key, port['addr'], net['prefix'])
interfaces.append((node, port['if']))
return interfaces
interfaces.append((node, port['if']))
return interfaces
@@
-263,18
+264,19
@@
class IPv4Setup(object):
@staticmethod
@keyword('Get IPv4 address of node "${node}" interface "${port}" '
'from "${nodes_addr}"')
@staticmethod
@keyword('Get IPv4 address of node "${node}" interface "${port}" '
'from "${nodes_addr}"')
- def get_ip_addr(node, i
nterface
, nodes_addr):
+ def get_ip_addr(node, i
face_key
, nodes_addr):
"""Return IPv4 address of the node port.
:param node: Node in the topology.
"""Return IPv4 address of the node port.
:param node: Node in the topology.
- :param i
nterface: Interface name
of the node.
+ :param i
face_key: Interface key
of the node.
:param nodes_addr: Nodes IPv4 addresses.
:type node: dict
:param nodes_addr: Nodes IPv4 addresses.
:type node: dict
- :type i
nterface
: str
+ :type i
face_key
: str
:type nodes_addr: dict
:return: IPv4 address.
:rtype: str
"""
:type nodes_addr: dict
:return: IPv4 address.
:rtype: str
"""
+ interface = Topology.get_interface_name(node, iface_key)
for net in nodes_addr.values():
for port in net['ports'].values():
host = port.get('node')
for net in nodes_addr.values():
for port in net['ports'].values():
host = port.get('node')
@@
-305,27
+307,25
@@
class IPv4Setup(object):
for node in nodes_info.values():
if node['type'] == NodeType.TG:
continue
for node in nodes_info.values():
if node['type'] == NodeType.TG:
continue
- for interface, interface_data in node['interfaces'].iteritems():
- interface_name = interface_data['name']
+ for iface_key in node['interfaces'].keys():
adj_node, adj_int = Topology.\
adj_node, adj_int = Topology.\
- get_adjacent_node_and_interface(nodes_info, node,
- interface_name)
- ip_address = IPv4Setup.get_ip_addr(adj_node, adj_int['name'],
+ get_adjacent_node_and_interface(nodes_info, node, iface_key)
+ ip_address = IPv4Setup.get_ip_addr(adj_node, adj_int,
nodes_addr)
nodes_addr)
- mac_address =
adj_int['mac_address']
- get_node(node).set_arp(i
nterface_name
, ip_address, mac_address)
+ mac_address =
Topology.get_interface_mac(adj_node, adj_int)
+ get_node(node).set_arp(i
face_key
, ip_address, mac_address)
@staticmethod
@staticmethod
- def add_arp_on_dut(node, i
nterface
, ip_address, mac_address):
+ def add_arp_on_dut(node, i
face_key
, ip_address, mac_address):
"""Set ARP cache entree on DUT node.
"""Set ARP cache entree on DUT node.
- :param node: Node in the topology.
- :param i
nterface: Interface name of the node
.
+ :param node:
VPP
Node in the topology.
+ :param i
face_key: Interface key
.
:param ip_address: IP address of the interface.
:param mac_address: MAC address of the interface.
:type node: dict
:param ip_address: IP address of the interface.
:param mac_address: MAC address of the interface.
:type node: dict
- :type i
nterface
: str
+ :type i
face_key
: str
:type ip_address: str
:type mac_address: str
"""
:type ip_address: str
:type mac_address: str
"""
- get_node(node).set_arp(i
nterface
, ip_address, mac_address)
+ get_node(node).set_arp(i
face_key
, ip_address, mac_address)