Skip to content
Snippets Groups Projects
Commit 1338291b authored by Georgios Katsikas's avatar Georgios Katsikas
Browse files

fix: refactoring of p4 fabric tna testing suite

parent 210ed934
No related branches found
No related tags found
2 merge requests!359Release TeraFlowSDN 5.0,!332feat: support for SD-Fabric dataplane
Showing
with 47 additions and 22 deletions
...@@ -25,7 +25,7 @@ from .l3nm_ietf_actn.L3NMIetfActnServiceHandler import L3NMIetfActnServiceHandle ...@@ -25,7 +25,7 @@ from .l3nm_ietf_actn.L3NMIetfActnServiceHandler import L3NMIetfActnServiceHandle
from .l3nm_nce.L3NMNCEServiceHandler import L3NMNCEServiceHandler from .l3nm_nce.L3NMNCEServiceHandler import L3NMNCEServiceHandler
from .l3slice_ietfslice.L3SliceIETFSliceServiceHandler import L3NMSliceIETFSliceServiceHandler from .l3slice_ietfslice.L3SliceIETFSliceServiceHandler import L3NMSliceIETFSliceServiceHandler
from .microwave.MicrowaveServiceHandler import MicrowaveServiceHandler from .microwave.MicrowaveServiceHandler import MicrowaveServiceHandler
from .p4_l1.p4_l1_service_handler import P4L1ServiceHandler from .p4_dummy_l1.p4_dummy_l1_service_handler import P4DummyL1ServiceHandler
from .tapi_tapi.TapiServiceHandler import TapiServiceHandler from .tapi_tapi.TapiServiceHandler import TapiServiceHandler
from .tapi_xr.TapiXrServiceHandler import TapiXrServiceHandler from .tapi_xr.TapiXrServiceHandler import TapiXrServiceHandler
from .optical_tfs.OpticalTfsServiceHandler import OpticalTfsServiceHandler from .optical_tfs.OpticalTfsServiceHandler import OpticalTfsServiceHandler
...@@ -105,7 +105,7 @@ SERVICE_HANDLERS = [ ...@@ -105,7 +105,7 @@ SERVICE_HANDLERS = [
FilterFieldEnum.DEVICE_DRIVER : [DeviceDriverEnum.DEVICEDRIVER_IETF_NETWORK_TOPOLOGY, DeviceDriverEnum.DEVICEDRIVER_ONF_TR_532], FilterFieldEnum.DEVICE_DRIVER : [DeviceDriverEnum.DEVICEDRIVER_IETF_NETWORK_TOPOLOGY, DeviceDriverEnum.DEVICEDRIVER_ONF_TR_532],
} }
]), ]),
(P4L1ServiceHandler, [ (P4DummyL1ServiceHandler, [
{ {
FilterFieldEnum.SERVICE_TYPE: ServiceTypeEnum.SERVICETYPE_L1NM, FilterFieldEnum.SERVICE_TYPE: ServiceTypeEnum.SERVICETYPE_L1NM,
FilterFieldEnum.DEVICE_DRIVER: DeviceDriverEnum.DEVICEDRIVER_P4, FilterFieldEnum.DEVICE_DRIVER: DeviceDriverEnum.DEVICEDRIVER_P4,
......
...@@ -29,7 +29,7 @@ from service.service.task_scheduler.TaskExecutor import TaskExecutor ...@@ -29,7 +29,7 @@ from service.service.task_scheduler.TaskExecutor import TaskExecutor
LOGGER = logging.getLogger(__name__) LOGGER = logging.getLogger(__name__)
METRICS_POOL = MetricsPool('Service', 'Handler', labels={'handler': 'p4_l1'}) METRICS_POOL = MetricsPool('Service', 'Handler', labels={'handler': 'p4_dummy_l1'})
def create_rule_set(endpoint_a, endpoint_b): def create_rule_set(endpoint_a, endpoint_b):
return json_config_rule_set( return json_config_rule_set(
...@@ -83,7 +83,7 @@ def find_names(uuid_a, uuid_b, device_endpoints): ...@@ -83,7 +83,7 @@ def find_names(uuid_a, uuid_b, device_endpoints):
return (endpoint_a, endpoint_b) return (endpoint_a, endpoint_b)
class P4L1ServiceHandler(_ServiceHandler): class P4DummyL1ServiceHandler(_ServiceHandler):
def __init__( # pylint: disable=super-init-not-called def __init__( # pylint: disable=super-init-not-called
self, service : Service, task_executor : TaskExecutor, **settings self, service : Service, task_executor : TaskExecutor, **settings
) -> None: ) -> None:
......
# Tests for P4 routing, ACL, and In-Band Network Telemetry functions # Tests for P4 routing, ACL, and In-Band Network Telemetry functions
This directory contains the necessary scripts and configurations to run tests atop a Stratum-based P4 whitebox that performs a set of network functions, including routing, access control list (ACL), and In-Band Network Telemetry (INT). This directory contains the necessary scripts and configurations to run tests atop a Stratum-based P4 whitebox that performs a set of network functions, including forwarding (L2), routing (L3), L3/L4 access control list (ACL), and In-Band Network Telemetry (INT).
The P4 data plane is based on ONF's SD-Fabric implementation, titled [fabric-tna](https://github.com/stratum/fabric-tna)
## Prerequisites ## Prerequisites
...@@ -16,6 +17,7 @@ pip3 install grpcio-tools ...@@ -16,6 +17,7 @@ pip3 install grpcio-tools
``` ```
The versions used for this test are: The versions used for this test are:
- `protobuf` 3.20.3 - `protobuf` 3.20.3
- `grpclib` 0.4.4 - `grpclib` 0.4.4
- `grpcio` 1.47.5 - `grpcio` 1.47.5
...@@ -29,11 +31,11 @@ First we copy it to /usr/local/bin/: ...@@ -29,11 +31,11 @@ First we copy it to /usr/local/bin/:
``` ```
Then, we include this path to the PYTHONPATH: Then, we include this path to the PYTHONPATH:
```shell ```shell
export PYTHONPATH="${PYTHONPATH}:/usr/local/bin/protoc-gen-grpclib_python" export PYTHONPATH="${PYTHONPATH}:/usr/local/bin/protoc-gen-grpclib_python"
``` ```
You need to build and deploy a software-based Stratum switch, before being able to use TFS to control it. You need to build and deploy a software-based Stratum switch, before being able to use TFS to control it.
To do so, follow the instructions in the `./topology` folder. To do so, follow the instructions in the `./topology` folder.
...@@ -41,7 +43,7 @@ To do so, follow the instructions in the `./topology` folder. ...@@ -41,7 +43,7 @@ To do so, follow the instructions in the `./topology` folder.
To conduct this test, follow the steps below. To conduct this test, follow the steps below.
### TFS re-deploy ### Deploy TFS
```shell ```shell
cd ~/tfs-ctrl/ cd ~/tfs-ctrl/
...@@ -67,7 +69,7 @@ The `./setup.sh` script copies from this directory. If you need to change the P4 ...@@ -67,7 +69,7 @@ The `./setup.sh` script copies from this directory. If you need to change the P4
## Tests ## Tests
The following tests are implemented. A set of tests is implemented, each focusing on different aspects of TFS.
For each of these tests, an auxiliary bash script allows to run it with less typing. For each of these tests, an auxiliary bash script allows to run it with less typing.
| Test | Bash Runner | Purpose | | Test | Bash Runner | Purpose |
...@@ -80,7 +82,7 @@ For each of these tests, an auxiliary bash script allows to run it with less typ ...@@ -80,7 +82,7 @@ For each of these tests, an auxiliary bash script allows to run it with less typ
Each of the tests above is described in detail below. Each of the tests above is described in detail below.
### Step 1: Copy the necessary P4 artifacts into the TFS SBI service pod ### Step 0: Copy the necessary P4 artifacts into the TFS SBI service pod
The setup script copies the necessary artifacts to the SBI service pod. The setup script copies the necessary artifacts to the SBI service pod.
It should be run just once, after a fresh install of TFS. It should be run just once, after a fresh install of TFS.
...@@ -89,34 +91,33 @@ If you `deploy/all.sh` again, you need to repeat this step. ...@@ -89,34 +91,33 @@ If you `deploy/all.sh` again, you need to repeat this step.
```shell ```shell
cd ~/tfs-ctrl/ cd ~/tfs-ctrl/
source my_deploy.sh && source tfs_runtime_env_vars.sh source my_deploy.sh && source tfs_runtime_env_vars.sh
bash src/tests/p4-int-routing-acl/setup.sh bash src/tests/p4-fabric-tna/setup.sh
``` ```
### Step 2: Bootstrap topology ### Step 1: Bootstrap topology
The bootstrap script registers the context, topology, links, and devices to TFS. The bootstrap script registers the context, topology, links, and devices to TFS.
```shell ```shell
cd ~/tfs-ctrl/ cd ~/tfs-ctrl/
bash src/tests/p4-int-routing-acl/run_test_01_bootstrap.sh bash src/tests/p4-fabric-tna/run_test_01_bootstrap.sh
``` ```
### Step 3: Provision rules via the SBI API ### Step 2: Manage L2, L3, ACL, and INT via the SBI API (rules)
Implement routing, ACL, and INT functions by installing P4 rules to the Stratum switch via the TFS SBI API. Implement forwarding, routing, ACL, and INT network functions by installing P4 rules to the Stratum switch via the TFS SBI API.
In this test, these rules are installed in batches, as the switch cannot digest all these rules at once.
```shell ```shell
cd ~/tfs-ctrl/ cd ~/tfs-ctrl/
bash src/tests/p4-int-routing-acl/run_test_02_rules_provision.sh bash src/tests/p4-fabric-tna/run_test_02a_sbi_provision_int_l2_l3_acl.sh
``` ```
### Step 4: Deprovision rules via the SBI API Deprovision forwarding, routing, ACL, and INT network functions by removing the previously installed P4 rules (via the TFS SBI API) from the Stratum switch.
Deprovision the routing, ACL, and INT network functions by removing the previously installed P4 rules (via the TFS SBI API) from the Stratum switch.
```shell ```shell
cd ~/tfs-ctrl/ cd ~/tfs-ctrl/
bash src/tests/p4-int-routing-acl/run_test_03_rules_deprovision.sh bash src/tests/p4-fabric-tna/run_test_02b_sbi_deprovision_int_l2_l3_acl.sh
``` ```
### Step 4: Deprovision topology ### Step 4: Deprovision topology
...@@ -125,5 +126,12 @@ Delete all the objects (context, topology, links, devices) from TFS: ...@@ -125,5 +126,12 @@ Delete all the objects (context, topology, links, devices) from TFS:
```shell ```shell
cd ~/tfs-ctrl/ cd ~/tfs-ctrl/
bash src/tests/p4-int-routing-acl/run_test_04_cleanup.sh bash src/tests/p4-fabric-tna/run_test_07_cleanup.sh
```
Alternatively, a purge test is implemented; this test removes services, links, devices, topology, and context in this order.
```shell
cd ~/tfs-ctrl/
bash src/tests/p4-fabric-tna/run_test_08_purge.sh
``` ```
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
# - tfs_runtime_env_vars.sh # - tfs_runtime_env_vars.sh
source tfs_runtime_env_vars.sh source tfs_runtime_env_vars.sh
python3 -m pytest --verbose src/tests/p4-int-routing-acl/test_functional_bootstrap.py python3 -m pytest --verbose src/tests/p4-fabric-tna/tests-setup/test_functional_bootstrap.py
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
# limitations under the License. # limitations under the License.
source tfs_runtime_env_vars.sh source tfs_runtime_env_vars.sh
python3 -m pytest --verbose src/tests/p4-int-routing-acl/test_functional_sbi_rules_deprovision.py python3 -m pytest --verbose src/tests/p4-fabric-tna/tests-sbi/test_functional_sbi_rules_provision.py
#!/bin/bash
# Copyright 2022-2024 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# 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.
source tfs_runtime_env_vars.sh
python3 -m pytest --verbose src/tests/p4-fabric-tna/tests-sbi/test_functional_sbi_rules_deprovision.py
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment