diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-01-25 20:17:54 +0000 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2019-01-30 07:18:20 +0000 |
commit | b573e5b2823746ca7940938df8cdaafca3812a1f (patch) | |
tree | 8acf27ff42fd316b912f786897cfb92a10ebf551 /resources/libraries | |
parent | c2a5a359b627e1db91cdf86ea642d2a6e576b195 (diff) |
CSIT-1409 Implement pipeline configuration for l2bd with memif/ip4.
Change-Id: I7463d47a9d65069332eb2a288ff44f4499a8a467
Signed-off-by: Peter Mikus <pmikus@cisco.com>
(cherry picked from commit 11bd03f27a53fa6060bfa72bc98c52532cb6e404)
Diffstat (limited to 'resources/libraries')
4 files changed, 227 insertions, 71 deletions
diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py index 4feeb8bea2..8c299247e8 100644 --- a/resources/libraries/python/ContainerUtils.py +++ b/resources/libraries/python/ContainerUtils.py @@ -167,8 +167,6 @@ class ContainerManager(object): dut_cnt = len(Counter([self.containers[container].node['host'] for container in self.containers])) mod = len(self.containers)/dut_cnt - container_vat_template = 'memif_create_{topology}.vat'.format( - topology=chain_topology) for i, container in enumerate(self.containers): mid1 = i % mod + 1 @@ -179,69 +177,157 @@ class ContainerManager(object): guest_dir = self.engine.container.mnt[0].split(':')[1] if chain_topology == 'chain': - self.engine.create_vpp_startup_config() - 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)) + self._configure_vpp_chain_l2xc(mid1=mid1, mid2=mid2, + sid1=sid1, sid2=sid2, + guest_dir=guest_dir, + **kwargs) elif chain_topology == 'cross_horiz': - try: - dut1_if = kwargs['dut1_if'] - dut2_if = kwargs['dut2_if'] - except KeyError: - 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) - if_name = Topology.get_interface_name( - self.engine.container.node, dut1_if) - if 'DUT2' in self.engine.container.name: - if_pci = Topology.get_interface_pci_addr( - self.engine.container.node, dut2_if) - if_name = Topology.get_interface_name( - self.engine.container.node, dut2_if) - self.engine.create_vpp_startup_config_dpdk_dev(if_pci) - 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=self.engine.container, sid=sid1, dir=guest_dir)) + self._configure_vpp_cross_horiz(mid1=mid1, mid2=mid2, + sid1=sid1, sid2=sid2, + guest_dir=guest_dir, + **kwargs) elif chain_topology == 'chain_functional': - memif_rx_mode = 'interrupt' - self.engine.create_vpp_startup_config_func_dev() - 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), - rx_mode=memif_rx_mode) + self._configure_vpp_chain_functional(mid1=mid1, mid2=mid2, + sid1=sid1, sid2=sid2, + guest_dir=guest_dir, + **kwargs) 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) + self._configure_vpp_chain_ip4(mid1=mid1, mid2=mid2, + sid1=sid1, sid2=sid2, + guest_dir=guest_dir, + **kwargs) + elif chain_topology == 'pipeline_ip4': + self._configure_vpp_pipeline_ip4(mid1=mid1, mid2=mid2, + sid1=sid1, sid2=sid2, + guest_dir=guest_dir, + **kwargs) else: - raise RuntimeError('Container topology {topology} not ' - 'implemented'. - format(topology=chain_topology)) + raise RuntimeError('Container topology {name} not implemented'. + format(name=chain_topology)) + + def _configure_vpp_chain_l2xc(self, **kwargs): + """Configure VPP in chain topology with l2xc. + + :param kwargs: Named parameters. + :param kwargs: dict + """ + self.engine.create_vpp_startup_config() + self.engine.create_vpp_exec_config( + 'memif_create_chain_l2xc.vat', + mid1=kwargs['mid1'], mid2=kwargs['mid2'], + sid1=kwargs['sid1'], sid2=kwargs['sid2'], + socket1='{guest_dir}/memif-{c.name}-{sid1}'. + format(c=self.engine.container, **kwargs), + socket2='{guest_dir}/memif-{c.name}-{sid2}'. + format(c=self.engine.container, **kwargs)) + + def _configure_vpp_cross_horiz(self, **kwargs): + """Configure VPP in cross horizontal topology (single memif). + + :param kwargs: Named parameters. + :param kwargs: dict + """ + if 'DUT1' in self.engine.container.name: + if_pci = Topology.get_interface_pci_addr( + self.engine.container.node, kwargs['dut1_if']) + if_name = Topology.get_interface_name( + self.engine.container.node, kwargs['dut1_if']) + if 'DUT2' in self.engine.container.name: + if_pci = Topology.get_interface_pci_addr( + self.engine.container.node, kwargs['dut2_if']) + if_name = Topology.get_interface_name( + self.engine.container.node, kwargs['dut2_if']) + self.engine.create_vpp_startup_config_dpdk_dev(if_pci) + self.engine.create_vpp_exec_config( + 'memif_create_cross_horizon.vat', + mid1=kwargs['mid1'], sid1=kwargs['sid1'], if_name=if_name, + socket1='{guest_dir}/memif-{c.name}-{sid1}'. + format(c=self.engine.container, **kwargs)) + + def _configure_vpp_chain_functional(self, **kwargs): + """Configure VPP in chain topology with l2xc (functional). + + :param kwargs: Named parameters. + :param kwargs: dict + """ + self.engine.create_vpp_startup_config_func_dev() + self.engine.create_vpp_exec_config( + 'memif_create_chain_functional.vat', + mid1=kwargs['mid1'], mid2=kwargs['mid2'], + sid1=kwargs['sid1'], sid2=kwargs['sid2'], + socket1='{guest_dir}/memif-{c.name}-{sid1}'. + format(c=self.engine.container, **kwargs), + socket2='{guest_dir}/memif-{c.name}-{sid2}'. + format(c=self.engine.container, **kwargs), + rx_mode='interrupt') + + def _configure_vpp_chain_ip4(self, **kwargs): + """Configure VPP in chain topology with ip4. + + :param kwargs: Named parameters. + :param kwargs: dict + """ + self.engine.create_vpp_startup_config() + + vif1_mac = kwargs['tg_if1_mac'] \ + if (kwargs['mid1'] - 1) % kwargs['nodes'] + 1 == 1 \ + else '52:54:00:00:{0:02X}:02'.format(kwargs['mid1'] - 1) + vif2_mac = kwargs['tg_if2_mac'] \ + if (kwargs['mid2'] - 1) % kwargs['nodes'] + 1 == kwargs['nodes'] \ + else '52:54:00:00:{0:02X}:01'.format(kwargs['mid2'] + 1) + self.engine.create_vpp_exec_config( + 'memif_create_chain_ip4.vat', + mid1=kwargs['mid1'], mid2=kwargs['mid2'], + sid1=kwargs['sid1'], sid2=kwargs['sid2'], + socket1='{guest_dir}/memif-{c.name}-{sid1}'. + format(c=self.engine.container, **kwargs), + socket2='{guest_dir}/memif-{c.name}-{sid2}'. + format(c=self.engine.container, **kwargs), + mac1='52:54:00:00:{0:02X}:01'.format(kwargs['mid1']), + mac2='52:54:00:00:{0:02X}:02'.format(kwargs['mid2']), + vif1_mac=vif1_mac, vif2_mac=vif2_mac) + + def _configure_vpp_pipeline_ip4(self, **kwargs): + """Configure VPP in pipeline topology with ip4. + + :param kwargs: Named parameters. + :param kwargs: dict + """ + self.engine.create_vpp_startup_config() + node = (kwargs['mid1'] - 1) % kwargs['nodes'] + 1 + mid1 = kwargs['mid1'] + mid2 = kwargs['mid2'] + role1 = 'master' + role2 = 'master' \ + if node == kwargs['nodes'] or node == kwargs['nodes'] and node == 1\ + else 'slave' + kwargs['mid2'] = kwargs['mid2'] \ + if node == kwargs['nodes'] or node == kwargs['nodes'] and node == 1\ + else kwargs['mid2'] + 1 + vif1_mac = kwargs['tg_if1_mac'] \ + if (kwargs['mid1'] - 1) % kwargs['nodes'] + 1 == 1 \ + else '52:54:00:00:{0:02X}:02'.format(kwargs['mid1'] - 1) + vif2_mac = kwargs['tg_if2_mac'] \ + if (kwargs['mid2'] - 1) % kwargs['nodes'] + 1 == kwargs['nodes'] \ + else '52:54:00:00:{0:02X}:01'.format(kwargs['mid2'] + 1) + socket1 = '{guest_dir}/memif-{c.name}-{sid1}'.\ + format(c=self.engine.container, **kwargs) \ + if node == 1 else '{guest_dir}/memif-pipe-{mid1}'.\ + format(c=self.engine.container, **kwargs) + socket2 = '{guest_dir}/memif-{c.name}-{sid2}'.\ + format(c=self.engine.container, **kwargs) \ + if node == 1 and kwargs['nodes'] == 1 or node == kwargs['nodes'] \ + else '{guest_dir}/memif-pipe-{mid2}'.\ + format(c=self.engine.container, **kwargs) + + self.engine.create_vpp_exec_config( + 'memif_create_pipeline_ip4.vat', + mid1=kwargs['mid1'], mid2=kwargs['mid2'], + sid1=kwargs['sid1'], sid2=kwargs['sid2'], + socket1=socket1, socket2=socket2, role1=role1, role2=role2, + 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) def stop_all_containers(self): """Stop all containers.""" diff --git a/resources/libraries/robot/performance/performance_configuration.robot b/resources/libraries/robot/performance/performance_configuration.robot index 5ade4fa037..5873701342 100644 --- a/resources/libraries/robot/performance/performance_configuration.robot +++ b/resources/libraries/robot/performance/performance_configuration.robot @@ -3105,6 +3105,68 @@ | | Set interfaces in path up | | Show Memif on all DUTs | ${nodes} +| Initialize L2 Bridge Domain for pipeline with memif pairs +| | [Documentation] +| | ... | Create pairs of Memif interfaces on all defined VPP nodes. Put each +| | ... | Memif interface to separate L2 bridge domain with one physical or +| | ... | virtual interface to create a service pipeline on DUT node. +| | ... +| | ... | *Arguments:* +| | ... | - nf_chain - NF pipe. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per pipeline. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize L2 Bridge Domain for pipeline with memif pairs \ +| | ... | \| 1 \| 1 \| +| | ... +| | [Arguments] | ${nf_chain}=${1} | ${nf_nodes}=${1} +| | ... +| | ${duts}= | Get Matches | ${nodes} | DUT* +| | :FOR | ${dut} | IN | @{duts} +| | | Add interface to bridge domain | ${nodes['${dut}']} | ${${dut}_if1} | ${1} +| | | Add interface to bridge domain | ${nodes['${dut}']} | ${${dut}_if2} | ${2} +| | | ${nf_id_frst}= | Evaluate | (${nf_chain}-${1}) * ${nf_nodes} + ${1} +| | | ${nf_id_last}= | Evaluate | (${nf_chain}-${1}) * ${nf_nodes} + ${nf_nodes} +| | | ${sid_frst}= | Evaluate | ${nf_id_frst} * ${2} - ${1} +| | | ${sid_last}= | Evaluate | ${nf_id_last} * ${2} +| | | Set up single memif interface on DUT node | ${nodes['${dut}']} +| | | ... | memif-${dut}_CNF | mid=${nf_id_frst} | sid=${sid_frst} +| | | ... | memif_if=${dut}-memif-${nf_id_frst}-if1 +| | | ... | rxq=${rxq_count_int} | txq=${rxq_count_int} +| | | Set up single memif interface on DUT node | ${nodes['${dut}']} +| | | ... | memif-${dut}_CNF | mid=${nf_id_last} | sid=${sid_last} +| | | ... | memif_if=${dut}-memif-${nf_id_last}-if2 +| | | ... | rxq=${rxq_count_int} | txq=${rxq_count_int} +| | | Add interface to bridge domain | ${nodes['${dut}']} +| | | ... | ${${dut}-memif-${nf_id_frst}-if1} | ${1} +| | | Add interface to bridge domain | ${nodes['${dut}']} +| | | ... | ${${dut}-memif-${nf_id_last}-if2} | ${2} + +| Initialize L2 Bridge Domain for multiple pipelines with memif pairs +| | [Documentation] +| | ... | Create pairs of Memif interfaces for defined number of NF pipelines +| | ... | 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 pipelines of NFs. Type: integer +| | ... | - nf_nodes - Number of NFs nodes per pipeline. Type: integer +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Initialize L2 Bridge Domain for multiple pipelines 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 for pipeline with memif pairs +| | | ... | nf_chain=${nf_chain} | nf_nodes=${nf_nodes} +| | Set interfaces in path up +| | Show Memif on all DUTs | ${nodes} + | Initialize L2 Bridge Domain with memif pairs and VLAN in circular topology | | [Documentation] | | ... | Create pairs of Memif interfaces on all defined VPP nodes. Put each @@ -3349,9 +3411,10 @@ | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | ${sock}= | Set Variable | memif-${dut}_CNF +| | | ${sid}= | Evaluate | (${number} * ${2}) - ${1} | | | Set up single memif interface on DUT node | ${nodes['${dut}']} | ${sock} -| | | ... | ${number} | ${dut}-memif-${number}-if1 | ${rxq_count_int} -| | | ... | ${rxq_count_int} +| | | ... | mid=${number} | sid=${sid} | memif_if=${dut}-memif-${number}-if1 +| | | ... | rxq=${rxq_count_int} | txq=${rxq_count_int} | | | Configure L2XC | ${nodes['${dut}']} | ${${dut}_if1} | | | ... | ${${dut}-memif-${number}-if1} | | Set single interfaces in path up @@ -3381,9 +3444,10 @@ | | ${duts}= | Get Matches | ${nodes} | DUT* | | :FOR | ${dut} | IN | @{duts} | | | ${sock}= | Set Variable | memif-${dut}_CNF +| | | ${sid}= | Evaluate | (${number} * ${2}) - ${1} | | | Set up single memif interface on DUT node | ${nodes['${dut}']} | ${sock} -| | | ... | ${number} | ${dut}-memif-${number}-if1 | ${rxq_count_int} -| | | ... | ${rxq_count_int} +| | | ... | mid=${number} | sid=${sid} | memif_if=${dut}-memif-${number}-if1 +| | | ... | rxq=${rxq_count_int} | txq=${rxq_count_int} | | | Add interface to bridge domain | ${nodes['${dut}']} | ${${dut}_if1} | | | ... | ${number} | | | Add interface to bridge domain | ${nodes['${dut}']} diff --git a/resources/libraries/robot/shared/container.robot b/resources/libraries/robot/shared/container.robot index cbfbccc787..c08dc71fa6 100644 --- a/resources/libraries/robot/shared/container.robot +++ b/resources/libraries/robot/shared/container.robot @@ -151,6 +151,10 @@ | | ... | ${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}' == 'pipeline_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} diff --git a/resources/libraries/robot/shared/memif.robot b/resources/libraries/robot/shared/memif.robot index a4334058c9..482a4cf77b 100644 --- a/resources/libraries/robot/shared/memif.robot +++ b/resources/libraries/robot/shared/memif.robot @@ -56,6 +56,7 @@ | | [Arguments] | ${dut_node} | ${filename1} | ${filename2} | ${mid}=${1} | | ... | ${memif_if1}=memif_if1 | ${memif_if2}=memif_if2 | ${rxq}=${1} | | ... | ${txq}=${1} | ${role}=slave | ${dcr_uuid}=${EMPTY} +| | ... | | ${sid_1}= | Evaluate | (${mid}*2)-1 | | ${sid_2}= | Evaluate | (${mid}*2) | | ${memif_1}= | Create memif interface | ${dut_node} @@ -75,12 +76,13 @@ | | ... | *Arguments:* | | ... | - dut_node - DUT node. Type: dictionary | | ... | - filename - Socket filename for Memif interface. Type: string -| | ... | - mid - Memif interface ID. Type: integer +| | ... | - mid - Memif interface ID (Optional). Type: integer +| | ... | - sid - Memif socket ID (Optional). Type: integer | | ... | - memif_if - Name of the Memif interface (Optional). | | ... | Type: string -| | ... | - rxq - RX queues. Type: integer -| | ... | - txq - TX queues. Type: integer -| | ... | - role - Memif role. Type: string +| | ... | - rxq - RX queues (Optional). Type: integer +| | ... | - txq - TX queues (Optional). Type: integer +| | ... | - role - Memif role (Optional). Type: string | | ... | | ... | _NOTE:_ This KW sets following test case variable: | | ... | - ${${memif_if}} - Memif interface. @@ -91,9 +93,9 @@ | | ... | \| ${nodes['DUT1']} \| sock1 \| 1 \| dut1_memif_if1 \| 1 \| 1 \ | | ... | \| slave \| | | ... -| | [Arguments] | ${dut_node} | ${filename} | ${mid}=${1} +| | [Arguments] | ${dut_node} | ${filename} | ${mid}=${1} | ${sid}=${1} | | ... | ${memif_if}=memif_if1 | ${rxq}=${1} | ${txq}=${1} | ${role}=slave -| | ${sid}= | Evaluate | (${mid}*2)-1 +| | ... | | ${memif}= | Create memif interface | ${dut_node} | ${filename}${mid}-${sid} | | ... | ${mid} | ${sid} | rxq=${rxq} | txq=${txq} | role=${role} | | Set Interface State | ${dut_node} | ${memif} | up |