From 9efb0fe5411cd3cd4eb7b8a6dbf2645ed18dbd1d Mon Sep 17 00:00:00 2001 From: Luc Provoost Date: Thu, 8 Apr 2021 19:48:33 +0200 Subject: cgnat test case added A cgnat test can now be executed. This test needs 3 PROX instances. The first one, the generator needs to have an interface on the private dataplane network. The second instance, the cgnat needs to have it's first dataplane interface on the private network, while the second data plane needs to be on the public network. The third instance will be playing the role of internet server that the generator is connecting to. It will have one dataplane interface on the public network. This third instance will increase the packet size of the received packets by padding it with zeros and it will send the packets back to the cgnat mutliple times. How many times is defined by a multiplier in the cgnat.cfg file. In that cgnat file, we also define a range of IP addresses that will be used for the dynamic source IP NAT-ing. Make sure that the ports are allowed to accept other IP addresses than their own (e.g. allowed address pairs) and that the range of IP addresses is not overlapping with other machines in the public network. Change-Id: Ibc1c8513ac4e8a304378814fceb28c090dff895f Signed-off-by: Luc Provoost --- .../helper-scripts/rapid/configs/cgnat.cfg | 81 +++++++++++++++++++ .../helper-scripts/rapid/configs/public_server.cfg | 57 +++++++++++++ .../helper-scripts/rapid/openstack-rapid.yaml | 65 ++++++++++----- .../helper-scripts/rapid/params_rapid.yaml | 5 +- .../rapid/rapid-openstack-server-2ports.yaml | 94 ++++++++++++++++++++++ .../helper-scripts/rapid/tests/cgnat.test | 64 +++++++++++++++ 6 files changed, 346 insertions(+), 20 deletions(-) create mode 100644 VNFs/DPPD-PROX/helper-scripts/rapid/configs/cgnat.cfg create mode 100644 VNFs/DPPD-PROX/helper-scripts/rapid/configs/public_server.cfg create mode 100644 VNFs/DPPD-PROX/helper-scripts/rapid/rapid-openstack-server-2ports.yaml create mode 100644 VNFs/DPPD-PROX/helper-scripts/rapid/tests/cgnat.test diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/configs/cgnat.cfg b/VNFs/DPPD-PROX/helper-scripts/rapid/configs/cgnat.cfg new file mode 100644 index 00000000..75267f35 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/configs/cgnat.cfg @@ -0,0 +1,81 @@ +;; +;; Copyright (c) 2021 Intel Corporation +;; +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at +;; +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. +;; + +[lua] +dofile("parameters.lua") +public_start_ip = string.match(dest_ip1,"%d+\.%d+\.%d+\.")..2 +public_stop_ip = string.match(dest_ip1,"%d+\.%d+\.%d+\.")..20 +cgnat_table = {} +cgnat_table.dynamic = { + {public_ip_range_start = ip(public_start_ip),public_ip_range_stop = ip(public_stop_ip), public_port = val_range(10,20000)}, +} +lpm4 = {} +lpm4.next_hops = { + {id = 0, port_id = 0, ip = ip("1.1.1.1"), mac = mac("00:00:00:00:00:01"), mpls = 0x212}, +} +lpm4.routes = {}; +lpm4.routes[1] = { + cidr = {ip = ip(0), depth = 1}, + next_hop_id = 0, +} + +[eal options] +-n=4 ; force number of memory channels +no-output=no ; disable DPDK debug output +eal=--proc-type auto ${eal} + +[port 0] +name=if0 +mac=hardware +vlan=yes +vdev=internal_tap +local ipv4=${local_ip1} + +[port 1] +name=if1 +mac=hardware +vlan=yes +vdev=external_tap +local ipv4=${local_ip2} + +[defaults] +mempool size=8K + +[global] +name=${name} + +[core $mcore] +mode=master + +[core $cores] +name=nat +task=0 +mode=cgnat +sub mode=l3 +private=yes +nat table=cgnat_table +route table=lpm4 +rx port=if0 +tx ports from routing table=if1 + +task=1 +mode=cgnat +sub mode=l3 +private=no +nat table=cgnat_table +route table=lpm4 +rx port=if1 +tx ports from routing table=if0 diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/configs/public_server.cfg b/VNFs/DPPD-PROX/helper-scripts/rapid/configs/public_server.cfg new file mode 100644 index 00000000..9ffd6e8f --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/configs/public_server.cfg @@ -0,0 +1,57 @@ +;; +;; Copyright (c) 2010-2019 Intel Corporation +;; +;; Licensed under the Apache License, Version 2.0 (the "License"); +;; you may not use this file except in compliance with the License. +;; You may obtain a copy of the License at +;; +;; http://www.apache.org/licenses/LICENSE-2.0 +;; +;; Unless required by applicable law or agreed to in writing, software +;; distributed under the License is distributed on an "AS IS" BASIS, +;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;; See the License for the specific language governing permissions and +;; limitations under the License. +;; + +[lua] +dofile("parameters.lua") + +[eal options] +-n=4 ; force number of memory channels +no-output=no ; disable DPDK debug output +eal=--proc-type auto ${eal} + +[port 0] +name=if0 +mac=hardware +vlan=yes +vdev=public_tap +local ipv4=${local_ip1} + +[defaults] +mempool size=8K + +[global] +name=${name} + +[core $mcore] +mode=master + +[core $cores] +name=PublicServer +task=0 +mode=swap +sub mode=l3 +rx port=if0 +tx cores=${self}t1 +drop=no + +task=1 +mode=mirror +sub mode=l3 +multiplier=2 +mirror size=300 +rx ring=yes +tx port=if0 +drop=no diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml index 16df0874..5915ed2b 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml @@ -13,8 +13,9 @@ parameters: PROX_key: {description: DO NOT CHANGE THIS DEFAULT KEY NAME, type: string, default: rapid_key} my_availability_zone: {description: availability_zone for Hosting VMs, type: string, default: nova} security_group: {description: Security Group to use, type: string, default: prox_security_group} - PROXVM_count: {description: Total number of testVMs to create, type: number, default: 2} - PROX2VM_count: {description: Total number of testVMs to create, type: number, default: 1} + PROXType1VM_count: {description: Total number of testVMs to create, type: number, default: 2} + PROXType2VM_count: {description: Total number of testVMs type 2 to create, type: number, default: 1} + PROXType3VM_count: {description: Total number of testVMs type 3 to create, type: number, default: 1} # The following paramters are not used, but are here in case you want to also # create the management and dataplane networks in this template @@ -26,6 +27,7 @@ parameters: data_net_cidr: {description: PROX private network CIDR,type: string, default: 30.30.1.0/24} data_net_pool_start: {description: Start of private network IP address allocation pool, type: string, default: 30.30.1.100} data_net_pool_end: {description: End of private network IP address allocation pool, type: string, default: 30.30.1.200} + data2_net_name: {description: Name of PROX private network 2 to be created, type: string, default: data2} dns: type: comma_delimited_list label: DNS nameservers @@ -33,11 +35,11 @@ parameters: default: '8.8.8.8' resources: - PROXVMs: + PROXType1VMs: type: OS::Heat::ResourceGroup description: Group of PROX VMs according to specs described in this section properties: - count: { get_param: PROXVM_count } + count: { get_param: PROXType1VM_count } resource_def: type: rapid-openstack-server.yaml properties: @@ -53,13 +55,13 @@ resources: depends_on: - MyConfig - PROX2VMs: + PROXType2VMs: type: OS::Heat::ResourceGroup description: Group of PROX VMs according to specs described in this section properties: - count: { get_param: PROX2VM_count } + count: { get_param: PROXType2VM_count } resource_def: - type: rapid-openstack-server.yaml + type: rapid-openstack-server-2ports.yaml properties: PROX_availability_zone : {get_param: my_availability_zone} PROX_security_group : {get_param: security_group} @@ -69,6 +71,27 @@ resources: PROX_public_net: {get_param: public_net_name} PROX_mgmt_net_id: {get_param: mgmt_net_name} PROX_data_net_id: {get_param: data_net_name} + PROX_data2_net_id: {get_param: data2_net_name} + PROX_config: {get_resource: MyConfig} + depends_on: + - MyConfig + + PROXType3VMs: + type: OS::Heat::ResourceGroup + description: Group of PROX VMs according to specs described in this section + properties: + count: { get_param: PROXType3VM_count } + resource_def: + type: rapid-openstack-server.yaml + properties: + PROX_availability_zone : {get_param: my_availability_zone} + PROX_security_group : {get_param: security_group} + PROX_image: {get_param: PROX_image} + PROX_key: {get_param: PROX_key} + PROX_server_name: rapidType3VM-%index% + PROX_public_net: {get_param: public_net_name} + PROX_mgmt_net_id: {get_param: mgmt_net_name} + PROX_data_net_id: {get_param: data2_net_name} PROX_config: {get_resource: MyConfig} depends_on: - MyConfig @@ -91,7 +114,8 @@ resources: rapid:rapid expire: False write_files: - - path: /opt/rapid/after_boot_do_not_run.sh + - path: /opt/rapid/after_boot.sh + # - path: /opt/rapid/after_boot_do_not_run.sh # after_boot.sh is ran by check_prox_system_setup.sh, if it exists # This can be used to fix some issues, like in the example below # Remove this section or rename the file, if you do not want to run @@ -113,25 +137,30 @@ outputs: number_of_servers: description: List of number or PROX instance value: - - {get_param: PROXVM_count} - - {get_param: PROX2VM_count} + - {get_param: PROXType1VM_count} + - {get_param: PROXType2VM_count} + - {get_param: PROXType3VM_count} server_name: description: List of list of names of the PROX instances value: - - {get_attr: [PROXVMs, name]} - - {get_attr: [PROX2VMs, name]} + - {get_attr: [PROXType1VMs, name]} + - {get_attr: [PROXType2VMs, name]} + - {get_attr: [PROXType3VMs, name]} mngmt_ips: description: List of list of Management IPs of the VMs value: - - {get_attr: [PROXVMs, mngmt_ip]} - - {get_attr: [PROX2VMs, mngmt_ip]} + - {get_attr: [PROXType1VMs, mngmt_ip]} + - {get_attr: [PROXType2VMs, mngmt_ip]} + - {get_attr: [PROXType3VMs, mngmt_ip]} data_plane_ips: description: List of list of list of DataPlane IPs of the VMs value: - - {get_attr: [PROXVMs, data_plane_ips]} - - {get_attr: [PROX2VMs, data_plane_ips]} + - {get_attr: [PROXType1VMs, data_plane_ips]} + - {get_attr: [PROXType2VMs, data_plane_ips]} + - {get_attr: [PROXType3VMs, data_plane_ips]} data_plane_macs: description: List of list of list of DataPlane MACs of the VMs value: - - {get_attr: [PROXVMs, data_plane_mac]} - - {get_attr: [PROX2VMs, data_plane_mac]} + - {get_attr: [PROXType1VMs, data_plane_mac]} + - {get_attr: [PROXType2VMs, data_plane_mac]} + - {get_attr: [PROXType3VMs, data_plane_mac]} diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml index 6b1d863c..9663fc36 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml @@ -4,5 +4,6 @@ parameters: PROX_image: rapidVM my_availability_zone: nova security_group: prox_security_group - PROXVM_count: 4 - PROX2VM_count: 0 + PROXType1VM_count: 3 + PROXType2VM_count: 0 + PROXType3VM_count: 0 diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid-openstack-server-2ports.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid-openstack-server-2ports.yaml new file mode 100644 index 00000000..e1095fbd --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid-openstack-server-2ports.yaml @@ -0,0 +1,94 @@ +heat_template_version: 2014-10-16 + +description: single server resource with 2 dataplane ports used by resource groups. + +parameters: + PROX_public_net: + type: string + PROX_mgmt_net_id: + type: string + PROX_data_net_id: + type: string + PROX_data2_net_id: + type: string + PROX_server_name: + type: string + PROX_availability_zone: + type: string + PROX_security_group: + type: string + PROX_image: + type: string + PROX_key: + type: string + PROX_config: + type: string + +resources: + PROX_instance: + type: OS::Nova::Server + properties: + name: { get_param: PROX_server_name } + availability_zone : {get_param: PROX_availability_zone} + flavor: {get_resource: PROX_flavor} + image: {get_param: PROX_image} + key_name: {get_param: PROX_key} + networks: + - port: {get_resource: mgmt_port } + - port: {get_resource: data_port } + - port: {get_resource: data2_port } + user_data: {get_param: PROX_config} + user_data_format: RAW + + PROX_flavor: + type: OS::Nova::Flavor + properties: + ram: 4096 + vcpus: 4 + disk: 80 + extra_specs: {"hw:mem_page_size": "large","hw:cpu_policy": "dedicated","hw:cpu_thread_policy":"isolate"} + + mgmt_port: + type: OS::Neutron::Port + properties: + network_id: { get_param: PROX_mgmt_net_id } + security_groups: + - {get_param: PROX_security_group} + + floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network: {get_param: PROX_public_net} + port_id: {get_resource: mgmt_port} + + data_port: + type: OS::Neutron::Port + properties: + network_id: { get_param: PROX_data_net_id } + security_groups: + - {get_param: PROX_security_group} + + data2_port: + type: OS::Neutron::Port + properties: + network_id: { get_param: PROX_data2_net_id } + security_groups: + - {get_param: PROX_security_group} + +outputs: + name: + description: Name of the PROX instance + value: {get_attr: [PROX_instance, name]} + mngmt_ip: + description: Management IP of the VM + value: {get_attr: [floating_ip, floating_ip_address ]} + data_plane_ips: + description: List of DataPlane IPs of the VM + value: + - {get_attr: [data_port, fixed_ips, 0, ip_address]} + - {get_attr: [data2_port, fixed_ips, 0, ip_address]} + data_plane_mac: + description: List of DataPlane MACs of the VM + value: + - {get_attr: [data_port, mac_address]} + - {get_attr: [data2_port, mac_address]} diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/tests/cgnat.test b/VNFs/DPPD-PROX/helper-scripts/rapid/tests/cgnat.test new file mode 100644 index 00000000..9136d038 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/tests/cgnat.test @@ -0,0 +1,64 @@ +## +## Copyright (c) 2010-2020 Intel Corporation +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## + +[TestParameters] +name = CGNATTesting +number_of_tests = 2 +total_number_of_test_machines = 3 + +[TestM1] +name = Generator +config_file = configs/gen_gw.cfg +dest_vm = 3 +gw_vm = 2 +mcore = [0] +gencores = [1] +latcores = [3] + +[TestM2] +name = CGNAT +config_file = configs/cgnat.cfg +dest_vm = 3 +mcore = [0] +cores = [1] +monitor = false +prox_socket = true +prox_launch_exit = true + +[TestM3] +name = PublicSide +config_file = configs/public_server.cfg +mcore = [0] +cores = [1] + +[test1] +test=warmuptest +flowsize=512 +imix=[64] +warmupspeed=1 +warmuptime=2 + +[test2] +test=flowsizetest +imixs=[[64]] +# the number of flows in the list need to be powers of 2, max 2^20 +# Select from following numbers: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576 +flows=[512] +drop_rate_threshold = 0.1 +lat_avg_threshold = 500 +lat_max_threshold = 1000 +accuracy = 0.1 +startspeed = 10 -- cgit 1.2.3-korg