Framework: Qemu alignments 42/28442/2
authorpmikus <pmikus@cisco.com>
Tue, 18 Aug 2020 09:57:26 +0000 (09:57 +0000)
committerPeter Mikus <pmikus@cisco.com>
Tue, 18 Aug 2020 10:18:00 +0000 (10:18 +0000)
Signed-off-by: pmikus <pmikus@cisco.com>
Change-Id: I20098fca8fb513accef3edc9a72bfd3c56bf9be2

resources/libraries/python/QemuUtils.py
resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h1024_p63_s64512.exec [new file with mode: 0644]
resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h16384_p63_s1032192.exec [new file with mode: 0644]
resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h4096_p63_s258048.exec [new file with mode: 0644]
resources/templates/vm/vpp_2vfpt_ethip4ipsec1tnl_plen30.exec [new file with mode: 0644]
resources/templates/vm/vpp_2vfpt_ethip4ipsec40tnl_plen30.exec [new file with mode: 0644]
resources/templates/vm/vpp_2vfpt_ip4base_plen24.exec [new file with mode: 0644]
resources/templates/vm/vpp_2vfpt_ip4scale200k_plen30.exec [new file with mode: 0644]
resources/templates/vm/vpp_2vfpt_ip4scale20k_plen30.exec [new file with mode: 0644]
resources/templates/vm/vpp_2vfpt_ip4scale2k_plen30.exec [new file with mode: 0644]

index bb0c20c..a148275 100644 (file)
@@ -143,7 +143,7 @@ class QemuUtils:
     def add_net_user(self):
         """Set managment port forwarding."""
         self._params.add_with_value(
-            u"netdev", f"user,id=mgmt,net=192.168.76.0/24,"
+            u"netdev", f"user,id=mgmt,net=172.16.255.0/24,"
             f"hostfwd=tcp::{self._vm_info[u'port']}-:22"
         )
         self._params.add_with_value(
@@ -171,14 +171,17 @@ class QemuUtils:
             u"serial", f"file:{self._temp.get(u'log')}"
         )
 
-    def add_drive_cdrom(self, drive_file):
+    def add_drive_cdrom(self, drive_file, index=None):
         """Set CD-ROM drive.
 
         :param drive_file: Path to drive image.
+        :param index: Drive index.
         :type drive_file: str
+        :type index: int
         """
+        index = f"index={index}," if index else u""
         self._params.add_with_value(
-            u"drive", f"file={drive_file},media=cdrom"
+            u"drive", f"file={drive_file},{index}media=cdrom"
         )
 
     def add_drive(self, drive_file, drive_format):
@@ -291,16 +294,16 @@ class QemuUtils:
         vpp_config.add_unix_cli_listen()
         vpp_config.add_unix_exec(running)
         vpp_config.add_socksvr()
+        vpp_config.add_statseg_per_node_counters(value=u"on")
         vpp_config.add_buffers_per_numa(107520)
+        vpp_config.add_heapsize(u"1G")
+        vpp_config.add_ip_heap_size(u"1G")
+        vpp_config.add_statseg_size(u"1G")
         vpp_config.add_cpu_main_core(u"0")
         if self._opt.get(u"smp") > 1:
             vpp_config.add_cpu_corelist_workers(f"1-{self._opt.get(u'smp')-1}")
         vpp_config.add_plugin(u"disable", u"default")
         vpp_config.add_plugin(u"enable", u"ping_plugin.so")
-        if "ipsec" in self._opt.get(u'vnf'):
-            vpp_config.add_plugin(u"enable", u"crypto_native_plugin.so")
-            vpp_config.add_plugin(u"enable", u"crypto_ipsecmb_plugin.so")
-            vpp_config.add_plugin(u"enable", u"crypto_openssl_plugin.so")
         if "2vfpt" in self._opt.get(u'vnf'):
             vpp_config.add_plugin(u"enable", u"avf_plugin.so")
         if "vhost" in self._opt.get(u'vnf'):
@@ -311,6 +314,14 @@ class QemuUtils:
             if not kwargs[u"jumbo_frames"]:
                 vpp_config.add_dpdk_no_multi_seg()
                 vpp_config.add_dpdk_no_tx_checksum_offload()
+        if "ipsec" in self._opt.get(u'vnf'):
+            vpp_config.add_plugin(u"enable", u"crypto_native_plugin.so")
+            vpp_config.add_plugin(u"enable", u"crypto_ipsecmb_plugin.so")
+            vpp_config.add_plugin(u"enable", u"crypto_openssl_plugin.so")
+        if "nat" in self._opt.get(u'vnf'):
+            vpp_config.add_nat(value=u"endpoint-dependent")
+            vpp_config.add_nat_max_translations_per_thread(value=655360)
+            vpp_config.add_plugin(u"enable", u"nat_plugin.so")
         vpp_config.write_config(startup)
 
         # Create VPP running configuration.
@@ -406,13 +417,15 @@ class QemuUtils:
         """
         if u"vpp" in self._opt.get(u"vnf"):
             self.create_kernelvm_config_vpp(**kwargs)
+            self.create_kernelvm_init(vnf_bin=self._opt.get(u"vnf_bin"))
         elif u"testpmd_io" in self._opt.get(u"vnf"):
             self.create_kernelvm_config_testpmd_io(**kwargs)
+            self.create_kernelvm_init(vnf_bin=self._opt.get(u"vnf_bin"))
         elif u"testpmd_mac" in self._opt.get(u"vnf"):
             self.create_kernelvm_config_testpmd_mac(**kwargs)
+            self.create_kernelvm_init(vnf_bin=self._opt.get(u"vnf_bin"))
         else:
             raise RuntimeError(u"QEMU: Unsupported VNF!")
-        self.create_kernelvm_init(vnf_bin=self._opt.get(u"vnf_bin"))
 
     def get_qemu_pids(self):
         """Get QEMU CPU pids.
diff --git a/resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h1024_p63_s64512.exec b/resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h1024_p63_s64512.exec
new file mode 100644 (file)
index 0000000..3d00a60
--- /dev/null
@@ -0,0 +1,19 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 via $nexthop1 $routeif1
+ip route add $route2 via $nexthop2 $routeif2
+
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+$nat
+
+show logging
+
+show version
\ No newline at end of file
diff --git a/resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h16384_p63_s1032192.exec b/resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h16384_p63_s1032192.exec
new file mode 100644 (file)
index 0000000..3d00a60
--- /dev/null
@@ -0,0 +1,19 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 via $nexthop1 $routeif1
+ip route add $route2 via $nexthop2 $routeif2
+
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+$nat
+
+show logging
+
+show version
\ No newline at end of file
diff --git a/resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h4096_p63_s258048.exec b/resources/templates/vm/vpp_2vfpt_ethip4_nat44ed_h4096_p63_s258048.exec
new file mode 100644 (file)
index 0000000..3d00a60
--- /dev/null
@@ -0,0 +1,19 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 via $nexthop1 $routeif1
+ip route add $route2 via $nexthop2 $routeif2
+
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+$nat
+
+show logging
+
+show version
\ No newline at end of file
diff --git a/resources/templates/vm/vpp_2vfpt_ethip4ipsec1tnl_plen30.exec b/resources/templates/vm/vpp_2vfpt_ethip4ipsec1tnl_plen30.exec
new file mode 100644 (file)
index 0000000..54cf428
--- /dev/null
@@ -0,0 +1,17 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 via $nexthop1 $routeif1
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+$ipsec
+
+show logging
+
+show version
diff --git a/resources/templates/vm/vpp_2vfpt_ethip4ipsec40tnl_plen30.exec b/resources/templates/vm/vpp_2vfpt_ethip4ipsec40tnl_plen30.exec
new file mode 100644 (file)
index 0000000..54cf428
--- /dev/null
@@ -0,0 +1,17 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 via $nexthop1 $routeif1
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+$ipsec
+
+show logging
+
+show version
diff --git a/resources/templates/vm/vpp_2vfpt_ip4base_plen24.exec b/resources/templates/vm/vpp_2vfpt_ip4base_plen24.exec
new file mode 100644 (file)
index 0000000..7563309
--- /dev/null
@@ -0,0 +1,17 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 via $nexthop1 $routeif1
+ip route add $route2 via $nexthop2 $routeif2
+
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+show logging
+
+show version
diff --git a/resources/templates/vm/vpp_2vfpt_ip4scale200k_plen30.exec b/resources/templates/vm/vpp_2vfpt_ip4scale200k_plen30.exec
new file mode 100644 (file)
index 0000000..1afa8c3
--- /dev/null
@@ -0,0 +1,17 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 count 100000 via $nexthop1 $routeif1
+ip route add $route2 count 100000 via $nexthop2 $routeif2
+
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+show logging
+
+show version
diff --git a/resources/templates/vm/vpp_2vfpt_ip4scale20k_plen30.exec b/resources/templates/vm/vpp_2vfpt_ip4scale20k_plen30.exec
new file mode 100644 (file)
index 0000000..8087fdb
--- /dev/null
@@ -0,0 +1,17 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 count 10000 via $nexthop1 $routeif1
+ip route add $route2 count 10000 via $nexthop2 $routeif2
+
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+show logging
+
+show version
diff --git a/resources/templates/vm/vpp_2vfpt_ip4scale2k_plen30.exec b/resources/templates/vm/vpp_2vfpt_ip4scale2k_plen30.exec
new file mode 100644 (file)
index 0000000..480abc5
--- /dev/null
@@ -0,0 +1,17 @@
+create interface avf 0000:00:03.0 num-rx-queues $queues
+create interface avf 0000:00:04.0 num-rx-queues $queues
+
+set interface ip address avf-0/0/3/0 $ip1
+set interface state avf-0/0/3/0 up
+
+set interface ip address avf-0/0/4/0 $ip2
+set interface state avf-0/0/4/0 up
+
+ip route add $route1 count 1000 via $nexthop1 $routeif1
+ip route add $route2 count 1000 via $nexthop2 $routeif2
+
+set ip neighbor static $arpif1 $arpip1 $arpmac1
+
+show logging
+
+show version