diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-01-16 07:18:02 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2019-01-28 20:18:18 +0000 |
commit | 54fec7b836c162cd901f04ef8066b4e987a9f88a (patch) | |
tree | 1665431976480ca09a77f1656c233d380bb5de21 /resources | |
parent | 81dc66a10a70bb606531523bab6ffe96621cc7d4 (diff) |
CSIT-1403 Implement multichain configuration for l2bd with memif/ip4.
Change-Id: Ia87156b2ba826eb0a9a93d756b9765c7373ca6ce
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources')
5 files changed, 187 insertions, 114 deletions
diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py index 11bb964665..4feeb8bea2 100644 --- a/resources/libraries/python/ContainerUtils.py +++ b/resources/libraries/python/ContainerUtils.py @@ -141,6 +141,7 @@ class ContainerManager(object): self.engine.container = self.containers[container] # We need to install supervisor client/server system to control VPP # as a service + self.engine.execute('apt-get update') self.engine.install_supervisor() self.engine.install_vpp() self.engine.restart_vpp() @@ -169,42 +170,29 @@ class ContainerManager(object): container_vat_template = 'memif_create_{topology}.vat'.format( topology=chain_topology) - if chain_topology == 'chain': - for i, container in enumerate(self.containers): - mid1 = i % mod + 1 - mid2 = i % mod + 1 - sid1 = i % mod * 2 + 1 - sid2 = i % mod * 2 + 2 - self.engine.container = self.containers[container] + for i, container in enumerate(self.containers): + mid1 = i % mod + 1 + mid2 = i % mod + 1 + sid1 = i % mod * 2 + 1 + sid2 = i % mod * 2 + 2 + self.engine.container = self.containers[container] + guest_dir = self.engine.container.mnt[0].split(':')[1] + + if chain_topology == 'chain': self.engine.create_vpp_startup_config() - c_name = self.engine.container.name - guest_dir = self.engine.container.mnt[0].split(':')[1] self.engine.create_vpp_exec_config( container_vat_template, mid1=mid1, mid2=mid2, sid1=sid1, sid2=sid2, - socket1='{dir}/memif-{c_name}-{sid}'. - format(c_name=c_name, sid=sid1, dir=guest_dir), - socket2='{dir}/memif-{c_name}-{sid}'. - format(c_name=c_name, sid=sid2, dir=guest_dir)) - elif chain_topology == 'cross_horiz': - if mod > 1: - raise RuntimeError('Container chain topology {topology} ' - 'supports only single container.'. - format(topology=chain_topology)) - for i, container in enumerate(self.containers): - mid1 = i % mod + 1 - sid1 = i % mod * 2 + 1 + socket1='{dir}/memif-{c.name}-{sid}'. + format(c=self.engine.container, sid=sid1, dir=guest_dir), + socket2='{dir}/memif-{c.name}-{sid}'. + format(c=self.engine.container, sid=sid2, dir=guest_dir)) + elif chain_topology == 'cross_horiz': try: dut1_if = kwargs['dut1_if'] - except KeyError: - raise AttributeError('Missing dut1_if parameter.') - try: dut2_if = kwargs['dut2_if'] except KeyError: - raise AttributeError('Missing dut2_if parameter.') - self.engine.container = self.containers[container] - c_name = self.engine.container.name - guest_dir = self.engine.container.mnt[0].split(':')[1] + raise AttributeError('DUT interfaces not specified!') if 'DUT1' in self.engine.container.name: if_pci = Topology.get_interface_pci_addr( self.engine.container.node, dut1_if) @@ -219,30 +207,41 @@ class ContainerManager(object): self.engine.create_vpp_exec_config( container_vat_template, mid1=mid1, sid1=sid1, if_name=if_name, - socket1='{dir}/memif-{c_name}-{sid}'. - format(c_name=c_name, sid=sid1, dir=guest_dir)) - elif chain_topology == 'chain_functional': - for i, container in enumerate(self.containers): - mid1 = i % mod + 1 - mid2 = i % mod + 1 - sid1 = i % mod * 2 + 1 - sid2 = i % mod * 2 + 2 + socket1='{dir}/memif-{c.name}-{sid}'. + format(c=self.engine.container, sid=sid1, dir=guest_dir)) + elif chain_topology == 'chain_functional': memif_rx_mode = 'interrupt' - self.engine.container = self.containers[container] self.engine.create_vpp_startup_config_func_dev() - c_name = self.engine.container.name - guest_dir = self.engine.container.mnt[0].split(':')[1] self.engine.create_vpp_exec_config( container_vat_template, mid1=mid1, mid2=mid2, sid1=sid1, sid2=sid2, - socket1='{dir}/memif-{c_name}-{sid}'. - format(c_name=c_name, sid=sid1, dir=guest_dir), - socket2='{dir}/memif-{c_name}-{sid}'. - format(c_name=c_name, sid=sid2, dir=guest_dir), + socket1='{dir}/memif-{c.name}-{sid}'. + format(c=self.engine.container, sid=sid1, dir=guest_dir), + socket2='{dir}/memif-{c.name}-{sid}'. + format(c=self.engine.container, sid=sid2, dir=guest_dir), rx_mode=memif_rx_mode) - else: - raise RuntimeError('Container topology {topology} not implemented'. - format(topology=chain_topology)) + elif chain_topology == 'chain_ip4': + self.engine.create_vpp_startup_config() + vif1_mac = kwargs['tg_if1_mac'] \ + if (mid1 - 1) % kwargs['nodes'] + 1 == 1 \ + else '52:54:00:00:{0:02X}:02'.format(mid1-1) + vif2_mac = kwargs['tg_if2_mac'] \ + if (mid2 - 1) % kwargs['nodes'] + 1 == kwargs['nodes'] \ + else '52:54:00:00:{0:02X}:01'.format(mid2+1) + self.engine.create_vpp_exec_config( + container_vat_template, + mid1=mid1, mid2=mid2, sid1=sid1, sid2=sid2, + socket1='{dir}/memif-{c.name}-{sid}'. + format(c=self.engine.container, sid=sid1, dir=guest_dir), + socket2='{dir}/memif-{c.name}-{sid}'. + format(c=self.engine.container, sid=sid2, dir=guest_dir), + mac1='52:54:00:00:{0:02X}:01'.format(mid1), + mac2='52:54:00:00:{0:02X}:02'.format(mid2), + vif1_mac=vif1_mac, vif2_mac=vif2_mac) + else: + raise RuntimeError('Container topology {topology} not ' + 'implemented'. + format(topology=chain_topology)) def stop_all_containers(self): """Stop all containers.""" @@ -310,10 +309,9 @@ class ContainerEngine(object): def install_supervisor(self): """Install supervisord inside a container.""" - self.execute('sleep 3') - self.execute('apt-get update') self.execute('apt-get install -y supervisor') - self.execute('echo "{config}" > {config_file}'. + self.execute('echo "{config}" > {config_file} && ' + 'supervisord -c {config_file}'. format( config='[unix_http_server]\n' 'file = /tmp/supervisor.sock\n\n' @@ -330,13 +328,10 @@ class ContainerEngine(object): 'loglevel=debug\n' 'nodaemon=false\n\n', config_file=SUPERVISOR_CONF)) - self.execute('supervisord -c {config_file}'. - format(config_file=SUPERVISOR_CONF)) def install_vpp(self): """Install VPP inside a container.""" self.execute('ln -s /dev/null /etc/sysctl.d/80-vpp.conf') - self.execute('apt-get update') # Workaround for install xenial vpp build on bionic ubuntu. self.execute('apt-get install -y wget') self.execute('deb=$(mktemp) && wget -O "${deb}" ' @@ -364,7 +359,6 @@ class ContainerEngine(object): 'priority=1', config_file=SUPERVISOR_CONF)) self.execute('supervisorctl reload') - self.execute('supervisorctl restart vpp') def restart_vpp(self): """Restart VPP service inside a container.""" diff --git a/resources/libraries/robot/performance/performance_configuration.robot b/resources/libraries/robot/performance/performance_configuration.robot index 2edc11b4e5..5ade4fa037 100644 --- a/resources/libraries/robot/performance/performance_configuration.robot +++ b/resources/libraries/robot/performance/performance_configuration.robot @@ -991,8 +991,8 @@ | | ${tg1_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2} | | ${dut1_if2_mac}= | Get Interface MAC | ${dut1} | ${dut1_if2} | | ${dut2_if1_mac}= | Get Interface MAC | ${dut2} | ${dut2_if1} -| | ${sock1}= | Set Variable | memif-DUT1_CNF1 -| | ${sock2}= | Set Variable | memif-DUT2_CNF1 +| | ${sock1}= | Set Variable | memif-DUT1_CNF +| | ${sock2}= | Set Variable | memif-DUT2_CNF | | Set up memif interfaces on DUT node | ${dut1} | ${sock1} | ${sock1} | | ... | ${1} | dut1-memif-1-if1 | dut1-memif-1-if2 | ${rxq_count_int} | | ... | ${rxq_count_int} @@ -2987,8 +2987,8 @@ | | [Arguments] | ${dut} | ${count} | | ... | | :FOR | ${number} | IN RANGE | 1 | ${count}+1 -| | | ${sock1}= | Set Variable | memif-${dut}_CNF1 -| | | ${sock2}= | Set Variable | memif-${dut}_CNF1 +| | | ${sock1}= | Set Variable | memif-${dut}_CNF +| | | ${sock2}= | Set Variable | memif-${dut}_CNF | | | ${prev_index}= | Evaluate | ${number}-1 | | | Set up memif interfaces on DUT node | ${nodes['${dut}']} | | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1 @@ -3024,39 +3024,41 @@ | Initialize L2 Bridge Domain with memif pairs on DUT node | | [Documentation] | | ... | Create pairs of Memif interfaces on DUT node. Put each Memif interface -| | ... | to separate L2 bridge domain with one physical or virtual interface +| | ... | to separate L2 bridge domain with one physical or memif interface | | ... | to create a chain accross DUT node. | | ... | | ... | *Arguments:* | | ... | - dut - DUT node. Type: dictionary -| | ... | - count - Number of memif pairs (containers). Type: integer +| | ... | - nf_chain - NF chain. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer | | ... | | ... | *Note:* | | ... | Socket paths for Memif are defined in following format: -| | ... | - /tmp/memif-\${dut}_CNF\${number}-\${sid} +| | ... | - /tmp/memif-\${dut}_CNF\${nf_id}-\${sid} | | ... | | ... | *Example:* | | ... | | ... | \| Initialize L2 Bridge Domain with memif pairs on DUT node \ -| | ... | \| ${dut} \| ${1} \| +| | ... | \| ${dut} \| 1 \| 1 \| | | ... -| | [Arguments] | ${dut} | ${count} +| | [Arguments] | ${dut} | ${nf_chain}=${1} | ${nf_nodes}=${1} | | ... -| | ${bd_id2}= | Evaluate | ${count}+1 +| | ${bd_id2}= | Evaluate | ${nf_nodes}+1 | | Add interface to bridge domain | ${nodes['${dut}']} | ${${dut}_if1} | ${1} | | Add interface to bridge domain | ${nodes['${dut}']} | ${${dut}_if2} | | ... | ${bd_id2} -| | :FOR | ${number} | IN RANGE | 1 | ${count}+1 -| | | ${sock1}= | Set Variable | memif-${dut}_CNF1 -| | | ${sock2}= | Set Variable | memif-${dut}_CNF1 +| | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes}+1 +| | | ${nf_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node} +| | | ${sock1}= | Set Variable | memif-${dut}_CNF +| | | ${sock2}= | Set Variable | memif-${dut}_CNF | | | Set up memif interfaces on DUT node | ${nodes['${dut}']} -| | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1 -| | | ... | ${dut}-memif-${number}-if2 | ${rxq_count_int} | ${rxq_count_int} -| | | ${bd_id2}= | Evaluate | ${number}+1 +| | | ... | ${sock1} | ${sock2} | ${nf_id} | ${dut}-memif-${nf_id}-if1 +| | | ... | ${dut}-memif-${nf_id}-if2 | ${rxq_count_int} | ${rxq_count_int} +| | | ${bd_id2}= | Evaluate | ${nf_node}+1 | | | Add interface to bridge domain | ${nodes['${dut}']} -| | | ... | ${${dut}-memif-${number}-if1} | ${number} +| | | ... | ${${dut}-memif-${nf_id}-if1} | ${nf_node} | | | Add interface to bridge domain | ${nodes['${dut}']} -| | | ... | ${${dut}-memif-${number}-if2} | ${bd_id2} +| | | ... | ${${dut}-memif-${nf_id}-if2} | ${bd_id2} | Initialize L2 Bridge Domain with memif pairs | | [Documentation] @@ -3065,18 +3067,41 @@ | | ... | virtual interface to create a chain accross DUT node. | | ... | | ... | *Arguments:* -| | ... | - count - Number of memif pairs (containers). Type: integer +| | ... | - nf_chain - NF chain. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer | | ... | | ... | *Example:* | | ... -| | ... | \| Initialize L2 Bridge Domain with memif pairs \| ${1} \| +| | ... | \| Initialize L2 Bridge Domain with memif pairs \| 1 \| 1 \| | | ... -| | [Arguments] | ${count}=${1} +| | [Arguments] | ${nf_chain}=${1} | ${nf_nodes}=${1} | | ... | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | Initialize L2 Bridge Domain with memif pairs on DUT node | ${dut} -| | | ... | ${count} +| | | ... | nf_chain=${nf_chain} | nf_nodes=${nf_nodes} + +| Initialize L2 Bridge Domain for multiple chains with memif pairs +| | [Documentation] +| | ... | Create pairs of Memif interfaces for defined number of NF chains +| | ... | with defined number of NF nodes on all defined VPP nodes. Add each +| | ... | Memif interface into L2 bridge domains with learning enabled +| | ... | with physical inteface or Memif interface of another NF. +| | ... +| | ... | *Arguments:* +| | ... | - nf_chains - Number of chains of NFs. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per chain. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize L2 Bridge Domain for multiple chains with memif pairs \ +| | ... | \| 1 \| 1 \| +| | ... +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} +| | ... +| | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains}+1 +| | | Initialize L2 Bridge Domain with memif pairs | nf_chain=${nf_chain} +| | | ... | nf_nodes=${nf_nodes} | | Set interfaces in path up | | Show Memif on all DUTs | ${nodes} @@ -3119,8 +3144,8 @@ | | ... | ${dut1} | ${subif_index_1} | TAG_REWRITE_METHOD=${tag_rewrite} | | ... | | ${number}= | Set Variable | ${1} -| | ${sock1}= | Set Variable | memif-DUT1_CNF1 -| | ${sock2}= | Set Variable | memif-DUT1_CNF1 +| | ${sock1}= | Set Variable | memif-DUT1_CNF +| | ${sock2}= | Set Variable | memif-DUT1_CNF | | ${memif_if1_name}= | Set Variable | DUT1-memif-${number}-if1 | | ${memif_if2_name}= | Set Variable | DUT1-memif-${number}-if2 | | Set up memif interfaces on DUT node | ${dut1} | ${sock1} | ${sock2} @@ -3131,9 +3156,9 @@ | | Add interface to bridge domain | ${dut1} | ${${memif_if2_name}} | ${bd_id2} | | Add interface to bridge domain | ${dut1} | ${subif_index_1} | ${bd_id2} | | ${sock1}= | Run Keyword If | '${dut2_status}' == 'PASS' -| | ... | Set Variable | memif-DUT2_CNF1 +| | ... | Set Variable | memif-DUT2_CNF | | ${sock2}= | Run Keyword If | '${dut2_status}' == 'PASS' -| | ... | Set Variable | memif-DUT2_CNF1 +| | ... | Set Variable | memif-DUT2_CNF | | ${memif_if1_name}= | Run Keyword If | '${dut2_status}' == 'PASS' | | ... | Set Variable | DUT2-memif-${number}-if1 | | ${memif_if2_name}= | Run Keyword If | '${dut2_status}' == 'PASS' @@ -3235,8 +3260,8 @@ | | ${fib_table_1}= | Evaluate | ${fib_table_1} - ${1} | | ${ip_base_start}= | Set Variable | ${31} | | :FOR | ${number} | IN RANGE | 1 | ${count+${1}} -| | | ${sock1}= | Set Variable | memif-${dut}_CNF1 -| | | ${sock2}= | Set Variable | memif-${dut}_CNF1 +| | | ${sock1}= | Set Variable | memif-${dut}_CNF +| | | ${sock2}= | Set Variable | memif-${dut}_CNF | | | Set up memif interfaces on DUT node | ${nodes['${dut}']} | | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1 | | | ... | ${dut}-memif-${number}-if2 | ${rxq_count_int} | ${rxq_count_int} @@ -3323,7 +3348,7 @@ | | ... | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} -| | | ${sock}= | Set Variable | memif-${dut}_CNF1 +| | | ${sock}= | Set Variable | memif-${dut}_CNF | | | Set up single memif interface on DUT node | ${nodes['${dut}']} | ${sock} | | | ... | ${number} | ${dut}-memif-${number}-if1 | ${rxq_count_int} | | | ... | ${rxq_count_int} @@ -3355,7 +3380,7 @@ | | ... | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} -| | | ${sock}= | Set Variable | memif-${dut}_CNF1 +| | | ${sock}= | Set Variable | memif-${dut}_CNF | | | Set up single memif interface on DUT node | ${nodes['${dut}']} | ${sock} | | | ... | ${number} | ${dut}-memif-${number}-if1 | ${rxq_count_int} | | | ... | ${rxq_count_int} diff --git a/resources/libraries/robot/performance/performance_setup.robot b/resources/libraries/robot/performance/performance_setup.robot index 4078196372..a70742f448 100644 --- a/resources/libraries/robot/performance/performance_setup.robot +++ b/resources/libraries/robot/performance/performance_setup.robot @@ -36,7 +36,9 @@ | | ... | _NOTE:_ This KW sets following suite variables: | | ... | - tg - TG node | | ... | - tg_if1 - 1st TG interface towards DUT. +| | ... | - tg_if1 - 1st TG interface MAC address. | | ... | - tg_if2 - 2nd TG interface towards DUT. +| | ... | - tg_if2 - 2nd TG interface MAC address. | | ... | - dut1 - DUT1 node | | ... | - dut1_if1 - 1st DUT interface towards TG. | | ... | - dut1_if2 - 2nd DUT interface towards TG. @@ -57,9 +59,13 @@ | | ${dut1_if1} | ${dut1}= | First Ingress Interface | | ${dut1_if2} | ${dut1}= | Last Egress Interface | | ${tg_if2} | ${tg}= | Last Interface +| | ${tg_if1_mac}= | Get Interface MAC | ${tg} | ${tg_if1} +| | ${tg_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2} | | Set Suite Variable | ${tg} | | Set Suite Variable | ${tg_if1} +| | Set Suite Variable | ${tg_if1_mac} | | Set Suite Variable | ${tg_if2} +| | Set Suite Variable | ${tg_if2_mac} | | Set Suite Variable | ${dut1} | | Set Suite Variable | ${dut1_if1} | | Set Suite Variable | ${dut1_if2} @@ -75,8 +81,10 @@ | | ... | | ... | _NOTE:_ This KW sets following suite variables: | | ... | - tg - TG node -| | ... | - tg_if1 - TG interface towards DUT1. -| | ... | - tg_if2 - TG interface towards DUT2. +| | ... | - tg_if1 - 1st TG interface towards DUT. +| | ... | - tg_if1 - 1st TG interface MAC address. +| | ... | - tg_if2 - 2nd TG interface towards DUT. +| | ... | - tg_if2 - 2nd TG interface MAC address. | | ... | - dut1 - DUT1 node | | ... | - dut1_if1 - DUT1 interface towards TG. | | ... | - dut1_if2 - DUT1 interface towards DUT2. @@ -103,9 +111,13 @@ | | ${dut2_if1} | ${dut2}= | Next Interface | | ${dut2_if2} | ${dut2}= | Next Interface | | ${tg_if2} | ${tg}= | Next Interface +| | ${tg_if1_mac}= | Get Interface MAC | ${tg} | ${tg_if1} +| | ${tg_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2} | | Set Suite Variable | ${tg} | | Set Suite Variable | ${tg_if1} +| | Set Suite Variable | ${tg_if1_mac} | | Set Suite Variable | ${tg_if2} +| | Set Suite Variable | ${tg_if2_mac} | | Set Suite Variable | ${dut1} | | Set Suite Variable | ${dut1_if1} | | Set Suite Variable | ${dut1_if2} @@ -124,8 +136,10 @@ | | ... | | ... | _NOTE:_ This KW sets following suite variables: | | ... | - tg - TG node -| | ... | - tg_if1 - TG interface towards DUT1. -| | ... | - tg_if2 - TG interface towards DUT2. +| | ... | - tg_if1 - 1st TG interface towards DUT. +| | ... | - tg_if1 - 1st TG interface MAC address. +| | ... | - tg_if2 - 2nd TG interface towards DUT. +| | ... | - tg_if2 - 2nd TG interface MAC address. | | ... | - dut1 - DUT1 node | | ... | - dut1_if1 - DUT1 interface towards TG. | | ... | - dut1_if2_1 - DUT1 interface 1 towards DUT2. @@ -168,10 +182,14 @@ | | ${dut1_if2_2} | ${dut1}= | Last Interface | | ${dut2_if1_1} | ${dut2}= | First Ingress Interface | | ${dut2_if1_2} | ${dut2}= | Last Egress Interface +| | ${tg_if1_mac}= | Get Interface MAC | ${tg} | ${tg_if1} +| | ${tg_if2_mac}= | Get Interface MAC | ${tg} | ${tg_if2} | | # Set suite variables | | Set Suite Variable | ${tg} | | Set Suite Variable | ${tg_if1} +| | Set Suite Variable | ${tg_if1_mac} | | Set Suite Variable | ${tg_if2} +| | Set Suite Variable | ${tg_if2_mac} | | Set Suite Variable | ${dut1} | | Set Suite Variable | ${dut1_if1} | | Set Suite Variable | ${dut1_if2_1} @@ -621,18 +639,23 @@ | | ... | *Arguments:* | | ... | - chains: Total number of chains. Type: integer | | ... | - nodeness: Total number of nodes per chain. Type: integer +| | ... | - auto_scale - If True, use same amount of Dataplane threads for +| | ... | network function as DUT, otherwise use single physical core for +| | ... | every network function. Type: boolean | | ... | | ... | *Example:* | | ... | | ... | \| Set up performance test with containers \| 1 \| 1 \| | | ... -| | [Arguments] | ${chains}=${1} | ${nodeness}=${1} +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${auto_scale}=${True} | | ... | | Set Test Variable | @{container_groups} | @{EMPTY} | | Set Test Variable | ${container_group} | CNF +| | Set Test Variable | ${nf_nodes} | | Import Library | resources.libraries.python.ContainerUtils.ContainerManager | | ... | engine=${container_engine} | WITH NAME | ${container_group} -| | Construct chains of containers on all DUTs | ${chains} | ${nodeness} +| | Construct chains of containers on all DUTs | ${nf_chains} | ${nf_nodes} +| | ... | auto_scale=${auto_scale} | | Acquire all '${container_group}' containers | | Create all '${container_group}' containers | | Configure VPP in all '${container_group}' containers diff --git a/resources/libraries/robot/shared/container.robot b/resources/libraries/robot/shared/container.robot index e1aba74ee1..cbfbccc787 100644 --- a/resources/libraries/robot/shared/container.robot +++ b/resources/libraries/robot/shared/container.robot @@ -25,12 +25,15 @@ | | [Documentation] | Construct 1 CNF of specific technology on all DUT nodes. | | ... | | ... | *Arguments:* -| | ... | - chains: Total number of chains (Optional). Type: integer, default +| | ... | - nf_chains: Total number of chains (Optional). Type: integer, default | | ... | value: ${1} -| | ... | - nodeness: Total number of nodes per chain (Optional). Type: integer, +| | ... | - nf_nodes: Total number of nodes per chain (Optional). Type: integer, | | ... | default value: ${1} -| | ... | - chain_id: Chain ID (Optional). Type: integer, default value: ${1} -| | ... | - node_id: Node ID (Optional). Type: integer, default value: ${1} +| | ... | - nf_chain: Chain ID (Optional). Type: integer, default value: ${1} +| | ... | - nf_node: Node ID (Optional). Type: integer, default value: ${1} +| | ... | - auto_scale - If True, use same amount of Dataplane threads for +| | ... | network function as DUT, otherwise use single physical core for +| | ... | every network function. Type: boolean | | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per | | ... | SUT/DUT not required. Type: boolean, default value: ${True} | | ... @@ -38,24 +41,25 @@ | | ... | | ... | \| Construct container on all DUTs \| 1 \| 1 \| 1 \| 1 \| ${True} \| | | ... -| | [Arguments] | ${chains}=${1} | ${nodeness}=${1} | ${chain_id}=${1} -| | ... | ${node_id}=${1} | ${set_nf_cpus}=${True} +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${nf_chain}=${1} +| | ... | ${nf_node}=${1} | ${auto_scale}=${True} | ${set_nf_cpus}=${True} | | ... | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} +| | | ${nf_id}= | Evaluate | (${nf_chain} - ${1}) * ${nf_nodes} + ${nf_node} | | | ${env}= | Create List | DEBIAN_FRONTEND=noninteractive | | | ${tmp}= | Get Variable Value | ${tmp_volume} | /tmp | | | ${mnt}= | Create List | ${tmp}:/mnt/host | /dev/vfio:/dev/vfio | | | ${nf_cpus}= | Run Keyword If | ${set_nf_cpus} | | | ... | Create network function CPU list | ${dut} -| | | ... | chains=${chains} | nodeness=${nodeness} | chain_id=${chain_id} -| | | ... | node_id=${node_id} | auto_scale=${True} +| | | ... | chains=${nf_chains} | nodeness=${nf_nodes} | chain_id=${nf_chain} +| | | ... | node_id=${nf_node} | auto_scale=${auto_scale} | | | ... | ELSE | Set Variable | ${None} | | | ${uuid_str}= | Run Keyword If | '${tmp}' == '/tmp' | | | ... | Set Variable | ${EMPTY} | | | ... | ELSE | Remove String | ${tmp} | ${dut}_VOL | | | &{cont_args}= | Create Dictionary -| | | ... | name=${dut}_${container_group}${chain_id}${node_id}${uuid_str} +| | | ... | name=${dut}_${container_group}${nf_id}${uuid_str} | | | ... | node=${nodes['${dut}']} | mnt=${mnt} | env=${env} | | | Run Keyword If | ${set_nf_cpus} | | | ... | Set To Dictionary | ${cont_args} | cpuset_cpus=${nf_cpus} @@ -65,9 +69,12 @@ | | [Documentation] | Construct 1 chain of 1..N CNFs on all DUT nodes. | | ... | | ... | *Arguments:* -| | ... | - chains: Total number of chains. Type: integer -| | ... | - nodeness: Total number of nodes per chain. Type: integer -| | ... | - chain_id: Chain ID. Type: integer +| | ... | - nf_chains: Total number of chains. Type: integer +| | ... | - nf_nodes: Total number of nodes per chain. Type: integer +| | ... | - nf_chain: Chain ID. Type: integer +| | ... | - auto_scale - If True, use same amount of Dataplane threads for +| | ... | network function as DUT, otherwise use single physical core for +| | ... | every network function. Type: boolean | | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per | | ... | SUT/DUT not required. Type: boolean, default value: ${True} | | ... @@ -76,21 +83,25 @@ | | ... | \| Construct chain of containers on all DUTs \| 1 \| 1 \| 1 \ | | ... | \| ${True} \| | | ... -| | [Arguments] | ${chains} | ${nodeness} | ${chain_id} | ${set_nf_cpus}=${True} +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${nf_chain}=${1} +| | ... | ${auto_scale}=${True} | ${set_nf_cpus}=${True} | | ... -| | :FOR | ${node_id} | IN RANGE | 1 | ${nodeness}+1 -| | | Construct container on all DUTs | chains=${chains} | nodeness=${nodeness} -| | | ... | chain_id=${chain_id} | node_id=${node_id} -| | | ... | set_nf_cpus=${set_nf_cpus} +| | :FOR | ${nf_node} | IN RANGE | 1 | ${nf_nodes}+1 +| | | Construct container on all DUTs | nf_chains=${nf_chains} +| | | ... | nf_nodes=${nf_nodes} | nf_chain=${nf_chain} | nf_node=${nf_node} +| | | ... | auto_scale=${auto_scale} | set_nf_cpus=${set_nf_cpus} | Construct chains of containers on all DUTs | | [Documentation] | Construct 1..N chains of 1..N CNFs on all DUT nodes. | | ... | | ... | *Arguments:* -| | ... | - chains: Total number of chains (Optional). Type: integer, default +| | ... | - nf_chains: Total number of chains (Optional). Type: integer, default | | ... | value: ${1} -| | ... | - nodeness: Total number of nodes per chain (Optional). Type: integer, +| | ... | - nf_nodes: Total number of nodes per chain (Optional). Type: integer, | | ... | default value: ${1} +| | ... | - auto_scale - If True, use same amount of Dataplane threads for +| | ... | network function as DUT, otherwise use single physical core for +| | ... | every network function. Type: boolean | | ... | - set_nf_cpus: Set False if CPUs allocatation for network function per | | ... | SUT/DUT not required. Type: boolean, default value: ${True} | | ... @@ -98,12 +109,13 @@ | | ... | | ... | \| Construct chains of containers on all DUTs \| 1 \| 1 \| | | ... -| | [Arguments] | ${chains}=${1} | ${nodeness}=${1} | ${set_nf_cpus}=${True} +| | [Arguments] | ${nf_chains}=${1} | ${nf_nodes}=${1} | ${auto_scale}=${True} +| | ... | ${set_nf_cpus}=${True} | | ... -| | :FOR | ${chain_id} | IN RANGE | 1 | ${chains}+1 -| | | Construct chain of containers on all DUTs | chains=${chains} -| | | ... | nodeness=${nodeness} | chain_id=${chain_id} -| | | ... | set_nf_cpus=${set_nf_cpus} +| | :FOR | ${nf_chain} | IN RANGE | 1 | ${nf_chains}+1 +| | | Construct chain of containers on all DUTs | nf_chains=${nf_chains} +| | | ... | nf_nodes=${nf_nodes} | nf_chain=${nf_chain} +| | | ... | auto_scale=${auto_scale} | set_nf_cpus=${set_nf_cpus} | Acquire all '${group}' containers | | [Documentation] | Acquire all container(s) in specific container group on @@ -135,7 +147,11 @@ | | ... | | ${dut1_if2} = | Get Variable Value | \${dut1_if2} | ${None} | | ${dut2_if2} = | Get Variable Value | \${dut2_if2} | ${None} -| | Run Keyword If | '${container_chain_topology}' == 'cross_horiz' +| | Run Keyword If | '${container_chain_topology}' == 'chain_ip4' +| | ... | ${group}.Configure VPP In All Containers | ${container_chain_topology} +| | ... | tg_if1_mac=${tg_if1_mac} | tg_if2_mac=${tg_if2_mac} +| | ... | nodes=${nf_nodes} +| | ... | ELSE IF | '${container_chain_topology}' == 'cross_horiz' | | ... | ${group}.Configure VPP In All Containers | ${container_chain_topology} | | ... | dut1_if=${dut1_if2} | dut2_if=${dut2_if2} | | ... | ELSE diff --git a/resources/templates/vat/memif_create_chain_ip4.vat b/resources/templates/vat/memif_create_chain_ip4.vat new file mode 100644 index 0000000000..1c9205a086 --- /dev/null +++ b/resources/templates/vat/memif_create_chain_ip4.vat @@ -0,0 +1,15 @@ +create memif socket id {sid1} filename {socket1} +create interface memif id {mid1} socket-id {sid1} hw-addr {mac1} master +set interface ip address memif{sid1}/{mid1} 1.1.{sid1}.1/24 +set interface state memif{sid1}/{mid1} up + +create memif socket id {sid2} filename {socket2} +create interface memif id {mid2} socket-id {sid2} hw-addr {mac2} master +set interface ip address memif{sid2}/{mid2} 1.1.{sid2}.1/24 +set interface state memif{sid2}/{mid2} up + +set ip arp static memif{sid1}/{mid1} 1.1.{sid1}.2 {vif1_mac} +set ip arp static memif{sid2}/{mid2} 1.1.{sid2}.2 {vif2_mac} + +ip route add 10.0.0.0/8 via 1.1.{sid1}.2 +ip route add 20.0.0.0/8 via 1.1.{sid2}.2 |