aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-07-24 15:11:37 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-07-24 15:25:19 +0100
commit0f3a2ec6d0f6af4de19878ead2330514b51afaf0 (patch)
treeb4c392b4f8661f84ca21b80232c973393ab41eb2 /yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
parentd85cefdffe8b3ccb9b919f1cb83be42152e9e802 (diff)
IxNetwork IPv4 mask format is x.x.x.x
When updating the IP packet in IxNextgen library, the IPv4 mask should be defined in the following format: x.x.x.x This mask defines the number of lower bits used to generate a random IP. For example: - mask length: 16 - mask string: 0.0.255.255 JIRA: YARDSTICK-1351 Change-Id: Ie3cbf0205aac83aea8d7f665bc068e8566238055 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
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.py7
1 files changed, 5 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 9058fa78c..a840feade 100644
--- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
+++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import ipaddress
import logging
import IxNetwork
@@ -397,15 +398,17 @@ class IxNextgen(object): # pragma: no cover
:param field: (str) field name, e.g.: scrIp, dstIp
:param ip_address: (str) IP address
:param seed: (int) seed length
- :param mask: (str) IP address mask
+ :param mask: (int) IP address mask length
:param count: (int) number of random IPs to generate
"""
field_descriptor = self._get_field_in_stack_item(ip_descriptor,
field)
+ random_mask = str(ipaddress.IPv4Address(
+ 2**(ipaddress.IPV4LENGTH - mask) - 1).compressed)
self.ixnet.setMultiAttribute(field_descriptor,
'-seed', seed,
'-fixedBits', ip_address,
- '-randomMask', mask,
+ '-randomMask', random_mask,
'-valueType', 'random',
'-countValue', count)
self.ixnet.commit()