aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py')
-rw-r--r--yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py46
1 files changed, 44 insertions, 2 deletions
diff --git a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
index b5e4172a9..6645d45fe 100644
--- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
+++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
@@ -216,6 +216,14 @@ class IxNextgen(object): # pragma: no cover
"""
return self.ixnet.getAttribute(proto, '-sessionStatus')
+ def get_topology_device_groups(self, topology):
+ """Get list of device groups in topology
+
+ :param topology: (str) topology descriptor
+ :return: (list) list of device groups descriptors
+ """
+ return self.ixnet.getList(topology, 'deviceGroup')
+
def is_traffic_running(self):
"""Returns true if traffic state == TRAFFIC_STATUS_STARTED"""
return self._get_traffic_state() == TRAFFIC_STATUS_STARTED
@@ -406,7 +414,7 @@ class IxNextgen(object): # pragma: no cover
self._create_flow_groups(uplink_endpoints, downlink_endpoints)
self._setup_config_elements()
- def create_ipv4_traffic_model(self, uplink_topologies, downlink_topologies):
+ def create_ipv4_traffic_model(self, uplink_endpoints, downlink_endpoints):
"""Create a traffic item and the needed flow groups
Each flow group inside the traffic item (only one is present)
@@ -418,7 +426,7 @@ class IxNextgen(object): # pragma: no cover
FlowGroup4: uplink2 <- downlink2
"""
self._create_traffic_item('ipv4')
- self._create_flow_groups(uplink_topologies, downlink_topologies)
+ self._create_flow_groups(uplink_endpoints, downlink_endpoints)
self._setup_config_elements(False)
def _update_frame_mac(self, ethernet_descriptor, field, mac_address):
@@ -1006,3 +1014,37 @@ class IxNextgen(object): # pragma: no cover
'-value', bgp_type)
self.ixnet.commit()
return obj
+
+ def add_interface(self, vport, ip, mac=None, gateway=None):
+ """Add protocol interface to the vport"""
+ log.debug("add_interface: mac='%s', ip='%s', gateway='%s'", mac, ip,
+ gateway)
+ obj = self.ixnet.add(vport, 'interface')
+ self.ixnet.commit()
+
+ if mac is not None:
+ self.ixnet.setMultiAttribute(obj + '/ethernet', '-macAddress', mac)
+
+ ipv4 = self.ixnet.add(obj, 'ipv4')
+ self.ixnet.setMultiAttribute(ipv4, '-ip', ip)
+
+ if gateway is not None:
+ self.ixnet.setMultiAttribute(ipv4, '-gateway', gateway)
+
+ self.ixnet.commit()
+
+ self.ixnet.setMultiAttribute(obj, '-enabled', 'true')
+ self.ixnet.commit()
+
+ return obj
+
+ def add_static_ipv4(self, iface, vport, start_ip, count):
+ """Add static IP range to the interface"""
+ log.debug("add_static_ipv4: start_ip:'%s', count:'%s'",
+ start_ip, count)
+ obj = self.ixnet.add(vport + '/protocols/static', 'ip')
+
+ self.ixnet.setMultiAttribute(obj, '-protocolInterface', iface,
+ '-ipStart', start_ip, '-count', count,
+ '-enabled', 'true')
+ self.ixnet.commit()