diff --git a/src/tests/p4/README.md b/src/tests/p4/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..43920d14d5e99214bb2ad8418cc4babcae5be91c
--- /dev/null
+++ b/src/tests/p4/README.md
@@ -0,0 +1,41 @@
+# Tests for P4 functionality of TeraFlowSDN
+
+This directory contains the necessary scripts and configurations to run tests for the P4 functionality of TFS.
+
+## Basic scripts
+
+To run the experiments you should use the five scripts in the following order:
+```
+setup.sh
+run_test_01_bootstrap.sh
+run_test_02_create_service.sh
+run_test_03_delete_service.sh
+run_test_04_cleanup.sh
+```
+
+The setup script copies the necessary artifacts to the SBI service pod. It should be run just once, after a fresh install of TFS.
+The bootstrap script registers the context, topology, links and, devices to TFS.
+The create service scripts establishes a service between two endpoints.
+The delete service script delete the aforementioned service.
+Cleanup script deletes all the objects (context, topology, links, devices) from TFS.
+
+## Objects file
+
+The above bash scripts make use of the corresponding python scripts found under `./tests/` directory.
+More important is the `./tests/Objects.py` file, which contains the definition of the Context, Topology, Devices, Links, Services. **This is the file that need changes in case of a new topology.**
+
+Check the `./tests/Objects.py` file before running the experiment to make sure that the switches details are correct (ip address, port, etc.)
+
+## Mininet topologies
+
+In the `./mininet/` directory there are different mininet topology examples. The current `./tests/Objects.py` file corresponds to the `./mininet/8switch3path.py` topology. Additionally there is a backup file `./tests/topologies/6switchObjects.py` which corresponds to the `./mininet/6switch2path.py`.
+
+## P4 artifacts
+
+In the `./p4/` directory there are the compiled p4 artifacts that contain the pipeline that will be pushed to the p4 switch, along with the p4-runtime definitions.
+The `./setup.sh` script copies from this directory. So if you need to change p4 program, make sure to put the compiled artifacts here.
+
+## Latency probe
+
+In the `./probe/` directory there is a little program which calculates latency between two hosts in mininet and sends them to the Monitoring component. For specific instructions, refer to the corresponding `./probe/README.md` file.
+
diff --git a/src/tests/p4/mininet/8switch3path.py b/src/tests/p4/mininet/8switch3path.py
new file mode 100755
index 0000000000000000000000000000000000000000..9a41e53fb60514412d8cd1cecf451b132663d8f3
--- /dev/null
+++ b/src/tests/p4/mininet/8switch3path.py
@@ -0,0 +1,127 @@
+#!/usr/bin/python
+
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/)
+# Copyright 2019-present Open Networking Foundation
+#
+# 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.
+
+import argparse
+
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.net import Mininet
+from mininet.node import Host
+from mininet.topo import Topo
+from stratum import StratumBmv2Switch
+
+CPU_PORT = 255
+
+class IPv4Host(Host):
+ """Host that can be configured with an IPv4 gateway (default route).
+ """
+
+ def config(self, mac=None, ip=None, defaultRoute=None, lo='up', gw=None,
+ **_params):
+ super(IPv4Host, self).config(mac, ip, defaultRoute, lo, **_params)
+ self.cmd('ip -4 addr flush dev %s' % self.defaultIntf())
+ self.cmd('ip -6 addr flush dev %s' % self.defaultIntf())
+ self.cmd('ip -4 link set up %s' % self.defaultIntf())
+ self.cmd('ip -4 addr add %s dev %s' % (ip, self.defaultIntf()))
+ if gw:
+ self.cmd('ip -4 route add default via %s' % gw)
+ # Disable offload
+ for attr in ["rx", "tx", "sg"]:
+ cmd = "/sbin/ethtool --offload %s %s off" % (
+ self.defaultIntf(), attr)
+ self.cmd(cmd)
+
+ def updateIP():
+ return ip.split('/')[0]
+
+ self.defaultIntf().updateIP = updateIP
+
+class TutorialTopo(Topo):
+ """Basic Server-Client topology with IPv4 hosts"""
+
+ def __init__(self, *args, **kwargs):
+ Topo.__init__(self, *args, **kwargs)
+
+ # Switches
+ # gRPC port 50001
+ switch1 = self.addSwitch('switch1', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50002
+ switch2 = self.addSwitch('switch2', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50003
+ switch3 = self.addSwitch('switch3', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50004
+ switch4 = self.addSwitch('switch4', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50005
+ switch5 = self.addSwitch('switch5', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50006
+ switch6 = self.addSwitch('switch6', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50007
+ switch7 = self.addSwitch('switch7', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+ # gRPC port 50008
+ switch8 = self.addSwitch('switch8', cls=StratumBmv2Switch, cpuport=CPU_PORT)
+
+ # Hosts
+ client = self.addHost('client', cls=IPv4Host, mac="aa:bb:cc:dd:ee:11",
+ ip='10.0.0.1/24', gw='10.0.0.100')
+ server = self.addHost('server', cls=IPv4Host, mac="aa:bb:cc:dd:ee:22",
+ ip='10.0.0.2/24', gw='10.0.0.100')
+
+ # Switch links
+ self.addLink(switch1, switch2) # Switch1:port 1, Switch2:port 1
+ self.addLink(switch1, switch4) # Switch1:port 2, Switch4:port 1
+ self.addLink(switch1, switch6) # Switch1:port 3, Switch6:port 1
+
+ self.addLink(switch2, switch3) # Switch2:port 2, Switch3:port 1
+ self.addLink(switch4, switch5) # Switch4:port 2, Switch5:port 1
+ self.addLink(switch6, switch7) # Switch6:port 2, Switch7:port 1
+
+ self.addLink(switch3, switch8) # Switch3:port 2, Switch8:port 1
+ self.addLink(switch5, switch8) # Switch5:port 2, Switch8:port 2
+ self.addLink(switch7, switch8) # Switch7:port 2, Switch8:port 3
+
+ # Host links
+ self.addLink(client, switch1) # Switch1: port 4
+ self.addLink(server, switch8) # Switch8: port 4
+
+def main():
+ net = Mininet(topo=TutorialTopo(), controller=None)
+ net.start()
+
+ #get hosts
+ client = net.hosts[0]
+ client.setARP('10.0.0.2', 'aa:bb:cc:dd:ee:22')
+ server = net.hosts[1]
+ server.setARP('10.0.0.1', 'aa:bb:cc:dd:ee:11')
+
+ CLI(net)
+ net.stop()
+ print '#' * 80
+ print 'ATTENTION: Mininet was stopped! Perhaps accidentally?'
+ print 'No worries, it will restart automatically in a few seconds...'
+ print 'To access again the Mininet CLI, use `make mn-cli`'
+ print 'To detach from the CLI (without stopping), press Ctrl-D'
+ print 'To permanently quit Mininet, use `make stop`'
+ print '#' * 80
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description='Mininet topology script for 2x2 fabric with stratum_bmv2 and IPv4 hosts')
+ args = parser.parse_args()
+ setLogLevel('info')
+
+ main()
diff --git a/src/tests/p4/probe/README.md b/src/tests/p4/probe/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..bfc1e4731dc44a61b32ad5d75093f4aca1f57dbf
--- /dev/null
+++ b/src/tests/p4/probe/README.md
@@ -0,0 +1,40 @@
+# Probe for P4 mininet devices
+
+Step 1:
+To copy the necessary files, run:
+
+```
+probe-tfs/deploy.sh
+```
+
+Step 2:
+To connect to the mininet docker, run:
+
+```
+probe-tfs/connect-to-mininet.sh
+```
+
+Step 3:
+From inside the mininet docker, run:
+
+```
+./tfsagent
+```
+
+Step 4 (on another terminal):
+Establish the service:
+```
+src/tests/p4/run_test_02_create_service.sh
+```
+
+Step 5:
+From inside mininet (make mn-cli):
+```
+client ./tfsping
+```
+
+Step 6 (on another terminal):
+To check the latest monitoring samples, run
+```
+python src/tests/p4/probe/monitoring_kpis.py
+```
diff --git a/src/tests/p4/probe/monitoring_kpis.ipynb b/src/tests/p4/probe/monitoring_kpis.ipynb
new file mode 100644
index 0000000000000000000000000000000000000000..728b7394eb9cbbf50fd5b4fcad568c0968abc608
--- /dev/null
+++ b/src/tests/p4/probe/monitoring_kpis.ipynb
@@ -0,0 +1,184 @@
+{
+ "cells": [
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Checking the monitoring component"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import time\n",
+ "import datetime\n",
+ "import uuid\n",
+ "import random\n",
+ "\n",
+ "from dotenv import load_dotenv\n",
+ "from IPython.display import clear_output, display, HTML\n",
+ "\n",
+ "from common.tools.timestamp.Converters import timestamp_utcnow_to_float, timestamp_float_to_string\n",
+ "from common.tools.grpc.Tools import grpc_message_to_json_string\n",
+ "from common.proto.kpi_sample_types_pb2 import KpiSampleType\n",
+ "from common.proto.monitoring_pb2 import KpiDescriptor, KpiId, KpiQuery, Kpi\n",
+ "from monitoring.client.MonitoringClient import MonitoringClient"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "'0abfb00117d4461b9fa5085bee4be58f'"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "load_dotenv()\n",
+ "\n",
+ "monitoring_client = MonitoringClient()\n",
+ "uuid.uuid4().hex"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Created KPI {\"kpi_id\": {\"uuid\": \"1\"}}: \n"
+ ]
+ }
+ ],
+ "source": [
+ "kpi_description: KpiDescriptor = KpiDescriptor()\n",
+ "kpi_description.kpi_description = \"Security status of service {}\".format(uuid.uuid4().hex)\n",
+ "kpi_description.service_id.service_uuid.uuid = \"608df176-90b8-5950-b50d-1810c6eaaa5d\"\n",
+ "kpi_description.kpi_sample_type = KpiSampleType.KPISAMPLETYPE_UNKNOWN\n",
+ "new_kpi = monitoring_client.SetKpi(kpi_description)\n",
+ "print(\"Created KPI {}: \".format(grpc_message_to_json_string(new_kpi)))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ " \n",
+ " 2023-02-24 16:23:34.373384 |
\n",
+ " KPI ID | Timestamp | Value |
\n",
+ " \n",
+ " 0 - 1 | 2023-02-23T13:55:09Z | floatVal: 1868.0\n",
+ " |
1 - 1 | 2023-02-23T13:55:07Z | floatVal: 1878.0\n",
+ " |
2 - 1 | 2023-02-23T13:55:05Z | floatVal: 2065.0\n",
+ " |
3 - 1 | 2023-02-23T13:55:03Z | floatVal: 1993.0\n",
+ " |
4 - 1 | 2023-02-23T13:55:01Z | floatVal: 2006.0\n",
+ " |
5 - 1 | 2023-02-23T13:54:59Z | floatVal: 1938.0\n",
+ " |
6 - 1 | 2023-02-23T13:54:57Z | floatVal: 1920.0\n",
+ " |
7 - 1 | 2023-02-23T13:54:55Z | floatVal: 1984.0\n",
+ " |
8 - 1 | 2023-02-23T13:54:53Z | floatVal: 1883.0\n",
+ " |
9 - 1 | 2023-02-23T13:54:51Z | floatVal: 1948.0\n",
+ " |
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "ename": "KeyboardInterrupt",
+ "evalue": "",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn [4], line 31\u001b[0m\n\u001b[1;32m 29\u001b[0m table \u001b[39m+\u001b[39m\u001b[39m=\u001b[39m \u001b[39m\"\u001b[39m\u001b[39m\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 30\u001b[0m display(HTML(table))\n\u001b[0;32m---> 31\u001b[0m time\u001b[39m.\u001b[39;49msleep(\u001b[39m5\u001b[39;49m)\n\u001b[1;32m 32\u001b[0m clear_output(wait\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m)\n",
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
+ ]
+ }
+ ],
+ "source": [
+ "kpi_id = input(\"What is the KPI ID?\")\n",
+ "query = KpiQuery()\n",
+ "query.kpi_ids.append(KpiId(**{\"kpi_id\": {\"uuid\": kpi_id}}))\n",
+ "query.last_n_samples = 10\n",
+ "\n",
+ "while True:\n",
+ "\n",
+ " kpi = Kpi()\n",
+ " kpi.kpi_id.kpi_id.uuid = new_kpi.kpi_id.uuid\n",
+ " kpi.timestamp.timestamp = timestamp_utcnow_to_float()\n",
+ " kpi.kpi_value.int32Val = random.randint(10, 4000)\n",
+ " # monitoring_client.IncludeKpi(kpi)\n",
+ "\n",
+ " response = monitoring_client.QueryKpiData(query)\n",
+ " # print(response)\n",
+ " table = f\"\"\"\n",
+ " \n",
+ " {datetime.datetime.now()} |
\n",
+ " KPI ID | Timestamp | Value |
\n",
+ " \n",
+ " \"\"\"\n",
+ " for kpi in response.raw_kpi_lists:\n",
+ " cur_kpi_id = kpi.kpi_id.kpi_id.uuid\n",
+ " for i, raw_kpi in enumerate(kpi.raw_kpis):\n",
+ " # print(cur_kpi_id, raw_kpi.timestamp.timestamp, raw_kpi.kpi_value)\n",
+ " table += \"{} - {} | {} | {} |
\".format(\n",
+ " i, cur_kpi_id, timestamp_float_to_string(raw_kpi.timestamp.timestamp), raw_kpi.kpi_value\n",
+ " )\n",
+ " table += \"
\"\n",
+ " display(HTML(table))\n",
+ " time.sleep(5)\n",
+ " clear_output(wait=True)"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "tfs",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.9.14"
+ },
+ "orig_nbformat": 4,
+ "vscode": {
+ "interpreter": {
+ "hash": "7ea5723b29014fc8d8bf1a065f5287f0787f54201758f2b5d4b4b0b2ddc48863"
+ }
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/src/tests/p4/probe/monitoring_kpis.py b/src/tests/p4/probe/monitoring_kpis.py
new file mode 100644
index 0000000000000000000000000000000000000000..880977a2f62069586efdb398b8b3b5d3ac20dac0
--- /dev/null
+++ b/src/tests/p4/probe/monitoring_kpis.py
@@ -0,0 +1,85 @@
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
+
+# File to monitor the latest *n* samples from the KPI ID *id*
+# and updates it every *i* seconds
+#
+# Author: Carlos Natalino
+
+import argparse
+import datetime
+import time
+
+from common.proto.kpi_sample_types_pb2 import KpiSampleType
+from common.proto.monitoring_pb2 import KpiDescriptor, KpiId, KpiQuery
+from common.tools.grpc.Tools import grpc_message_to_json_string
+from common.tools.timestamp.Converters import timestamp_float_to_string
+from monitoring.client.MonitoringClient import MonitoringClient
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "-n",
+ "--last-n-samples",
+ default=10,
+ type=int,
+ help="Number of latest samples of the KPI to show.",
+ )
+ parser.add_argument(
+ "-s",
+ "--sleep",
+ default=5,
+ type=int,
+ help="Seconds between consecutive refreshes.",
+ )
+ parser.add_argument("-id", "--kpi-id", help="KPI ID, if known.")
+ args = parser.parse_args()
+
+ monitoring_client = MonitoringClient()
+
+ if args.kpi_id is None:
+ service_uuid = "608df176-90b8-5950-b50d-1810c6eaaa5d"
+ kpi_description: KpiDescriptor = KpiDescriptor()
+ kpi_description.kpi_description = "Security status of service {}".format(
+ service_uuid
+ )
+ kpi_description.service_id.service_uuid.uuid = service_uuid
+ kpi_description.kpi_sample_type = KpiSampleType.KPISAMPLETYPE_UNKNOWN
+ new_kpi = monitoring_client.SetKpi(kpi_description)
+ print("Created KPI {}: ".format(grpc_message_to_json_string(new_kpi)))
+ kpi_id = new_kpi.kpi_id.uuid
+ else:
+ kpi_id = args.kpi_id
+
+ query = KpiQuery()
+ query.kpi_ids.append(KpiId(**{"kpi_id": {"uuid": kpi_id}}))
+ query.last_n_samples = args.last_n_samples
+
+ while True:
+ print(chr(27) + "[2J")
+ response = monitoring_client.QueryKpiData(query)
+ print("{}\t{}\t{:<20}\t{}".format("Index", "KPI ID", "Timestamp", "Value"))
+ for kpi in response.raw_kpi_lists:
+ cur_kpi_id = kpi.kpi_id.kpi_id.uuid
+ for i, raw_kpi in enumerate(kpi.raw_kpis):
+ print(
+ "{}\t{}\t{}\t{}".format(
+ i,
+ cur_kpi_id,
+ timestamp_float_to_string(raw_kpi.timestamp.timestamp),
+ raw_kpi.kpi_value.floatVal,
+ )
+ )
+ print("Last update:", datetime.datetime.now().strftime("%H:%M:%S"))
+ time.sleep(args.sleep)
diff --git a/src/tests/p4/probe/probe-tfs/.gitignore b/src/tests/p4/probe/probe-tfs/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..dc8d7ee54c37fd887f19206592ed03a33118a59a
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/.gitignore
@@ -0,0 +1,18 @@
+# Generated by Cargo
+# will have compiled files and executables
+/target/
+
+# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
+# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
+Cargo.lock
+
+# These are backup files generated by rustfmt
+**/*.rs.bk
+
+
+# Added by cargo
+
+/target
+
+.env_bkp
+.env
diff --git a/src/tests/p4/probe/probe-tfs/Cargo.toml b/src/tests/p4/probe/probe-tfs/Cargo.toml
new file mode 100644
index 0000000000000000000000000000000000000000..fb5db98bf5233e905d83b7f9fe06d44a71c3a0fd
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/Cargo.toml
@@ -0,0 +1,39 @@
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
+
+[package]
+name = "rust-tfs"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+dotenv = "0.15.0"
+futures = "0.3.26"
+prost = "0.11.6"
+surge-ping = "0.7.3"
+tokio = { version = "1.25", features = ["macros", "rt-multi-thread"] }
+tonic = "0.8.3"
+
+[[bin]]
+name = "tfsping"
+path = "src/ping.rs"
+
+[[bin]]
+name = "tfsagent"
+path = "src/agent.rs"
+
+[build-dependencies]
+tonic-build = "0.8.3"
diff --git a/src/tests/p4/probe/probe-tfs/LICENSE b/src/tests/p4/probe/probe-tfs/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/src/tests/p4/probe/probe-tfs/README.md b/src/tests/p4/probe/probe-tfs/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..f88d7c542dae22ad623797f43750e0589d2473cf
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/README.md
@@ -0,0 +1,2 @@
+# rust-tfs
+Client for TFS functionalities written in Rust.
diff --git a/src/tests/p4/probe/probe-tfs/build.rs b/src/tests/p4/probe/probe-tfs/build.rs
new file mode 100644
index 0000000000000000000000000000000000000000..1dda249d16b3c571676a254f2178f772fb765c81
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/build.rs
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
+ *
+ * Build script that generates Rust code for the protobuffers.
+ *
+ * Author: Carlos Natalino
+ */
+
+fn main() {
+ tonic_build::configure()
+ .build_server(false)
+ .compile(
+ &[
+ "proto/context.proto",
+ "proto/acl.proto",
+ "proto/kpi_sample_types.proto",
+ "proto/monitoring.proto",
+ ],
+ &["proto"],
+ )
+ .unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e));
+}
diff --git a/src/tests/p4/probe/probe-tfs/connect_to_mininet.sh b/src/tests/p4/probe/probe-tfs/connect_to_mininet.sh
new file mode 100755
index 0000000000000000000000000000000000000000..bba3eaa9a985f3e546f9df2681879faef0a9b83e
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/connect_to_mininet.sh
@@ -0,0 +1,16 @@
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
+
+CONTAINER=`docker ps | grep mininet | cut -f1 -d" "`
+docker exec -it $CONTAINER /bin/bash
diff --git a/src/tests/p4/probe/probe-tfs/deploy.sh b/src/tests/p4/probe/probe-tfs/deploy.sh
new file mode 100755
index 0000000000000000000000000000000000000000..733f02d11ecd4a9de90898b210b2fe9b579447f2
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/deploy.sh
@@ -0,0 +1,37 @@
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
+
+# build the software
+# uncomment the line below if you want to build it
+# cargo build --release --target=x86_64-unknown-linux-musl
+
+# build a .env file with the info from context and monitoring services
+
+if [ -z "${CONTEXTSERVICE_SERVICE_HOST}" ] || [ -z "${CONTEXTSERVICE_SERVICE_PORT_GRPC}" ] || \
+ [ -z "${MONITORINGSERVICE_SERVICE_HOST}" ] || [ -z "${MONITORINGSERVICE_SERVICE_PORT_GRPC}" ]
+then
+ echo "TFS_ENV_VARS are not loaded."
+ exit 1
+fi
+
+echo "CONTEXTSERVICE_SERVICE_HOST=${CONTEXTSERVICE_SERVICE_HOST}" > .env
+echo "CONTEXTSERVICE_SERVICE_PORT_GRPC=${CONTEXTSERVICE_SERVICE_PORT_GRPC}" >> .env
+echo "MONITORINGSERVICE_SERVICE_HOST=${MONITORINGSERVICE_SERVICE_HOST}" >> .env
+echo "MONITORINGSERVICE_SERVICE_PORT_GRPC=${MONITORINGSERVICE_SERVICE_PORT_GRPC}" >> .env
+
+# get container id
+CONTAINER=`docker ps | grep mininet | cut -f1 -d" "`
+docker cp target/x86_64-unknown-linux-musl/release/tfsping $CONTAINER:/root
+docker cp target/x86_64-unknown-linux-musl/release/tfsagent $CONTAINER:/root
+docker cp .env $CONTAINER:/root
diff --git a/src/tests/p4/probe/probe-tfs/proto b/src/tests/p4/probe/probe-tfs/proto
new file mode 120000
index 0000000000000000000000000000000000000000..ce803d6a96f0064d107428238b9beecb2a0ed2be
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/proto
@@ -0,0 +1 @@
+../../../../../proto
\ No newline at end of file
diff --git a/src/tests/p4/probe/probe-tfs/src/agent.rs b/src/tests/p4/probe/probe-tfs/src/agent.rs
new file mode 100644
index 0000000000000000000000000000000000000000..4221cbe28ba75021d2b7c2de6dbef46a043cc2bb
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/src/agent.rs
@@ -0,0 +1,254 @@
+/**
+ * Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
+ *
+ * Program that starts the ping probe and reports it to the Unix socket.
+ *
+ * Author: Carlos Natalino
+ */
+
+/************** Modules needed to communicate with TeraFlowSDN ***************/
+pub mod kpi_sample_types {
+ tonic::include_proto!("kpi_sample_types");
+}
+
+pub mod acl {
+ tonic::include_proto!("acl");
+}
+
+pub mod context {
+ // tonic::include_proto!();
+ tonic::include_proto!("context");
+}
+
+pub mod monitoring {
+ tonic::include_proto!("monitoring");
+}
+
+/********************************** Imports **********************************/
+// standard library
+use std::env;
+use std::path::Path;
+use std::sync::Arc;
+use std::time::SystemTime;
+use std::{fs, io};
+
+// external libraries
+use dotenv::dotenv;
+use futures;
+use futures::lock::Mutex;
+use tokio::net::UnixListener;
+
+// proto
+use context::context_service_client::ContextServiceClient;
+use context::{Empty, Timestamp};
+use kpi_sample_types::KpiSampleType;
+use monitoring::monitoring_service_client::MonitoringServiceClient;
+use monitoring::{Kpi, KpiDescriptor, KpiValue};
+
+#[tokio::main]
+async fn main() -> Result<(), Box> {
+ dotenv().ok(); // load the environment variables from the .env file
+
+ let path = Path::new("/tmp/tfsping");
+
+ if path.exists() {
+ fs::remove_file(path)?; // removes the socket in case it exists
+ }
+
+ let listener = UnixListener::bind(path).unwrap();
+ println!("Bound to the path {:?}", path);
+
+ // ARC Mutex that tells whether or not to send the results to the monitoring component
+ let send_ping = Arc::new(Mutex::new(false));
+ // copy used by the task that receives data from the probe
+ let ping_probe = send_ping.clone();
+ // copy used by the task that receives stream data from TFS
+ let ping_trigger = send_ping.clone();
+
+ // ARC mutex that hosts the KPI ID to be used as the monitoring KPI
+ let kpi_id: Arc>> = Arc::new(Mutex::new(None));
+ let kpi_id_probe = kpi_id.clone();
+ let kpi_id_trigger = kpi_id.clone();
+
+ let t1 = tokio::spawn(async move {
+ let monitoring_host = env::var("MONITORINGSERVICE_SERVICE_HOST")
+ .unwrap_or_else(|_| panic!("receiver: Could not find monitoring host!"));
+ let monitoring_port = env::var("MONITORINGSERVICE_SERVICE_PORT_GRPC")
+ .unwrap_or_else(|_| panic!("receiver: Could not find monitoring port!"));
+
+ let mut monitoring_client = MonitoringServiceClient::connect(format!(
+ "http://{}:{}",
+ monitoring_host, monitoring_port
+ ))
+ .await
+ .unwrap();
+ println!("receiver: Connected to the monitoring service!");
+ loop {
+ println!("receiver: Awaiting for new connection!");
+ let (stream, _socket) = listener.accept().await.unwrap();
+
+ stream.readable().await.unwrap();
+
+ let mut buf = [0; 4];
+
+ match stream.try_read(&mut buf) {
+ Ok(n) => {
+ let num = u32::from_be_bytes(buf);
+ println!("receiver: read {} bytes -- {:?}", n, num);
+
+ let should_ping = ping_probe.lock().await;
+
+ if *should_ping {
+ // only send the value to monitoring if needed
+ // send the value to the monitoring component
+ println!("receiver: Send value to monitoring");
+
+ let kpi_id = kpi_id_probe.lock().await;
+ println!("receiver: kpi id: {:?}", kpi_id);
+
+ let now = SystemTime::now()
+ .duration_since(SystemTime::UNIX_EPOCH)
+ .unwrap()
+ .as_secs(); // See struct std::time::Duration methods
+
+ let kpi = Kpi {
+ kpi_id: kpi_id.clone(),
+ timestamp: Some(Timestamp {
+ timestamp: now as f64,
+ }),
+ kpi_value: Some(KpiValue {
+ value: Some(monitoring::kpi_value::Value::Int32Val(num as i32)),
+ }),
+ };
+ // println!("Request: {:?}", kpi);
+ let response = monitoring_client
+ .include_kpi(tonic::Request::new(kpi))
+ .await;
+ // println!("Response: {:?}", response);
+ if response.is_err() {
+ println!("receiver: Issue with the response from monitoring!");
+ }
+ }
+ }
+ Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
+ continue;
+ }
+ Err(e) => {
+ println!("receiver: {:?}", e);
+ }
+ }
+ }
+ });
+
+ let t2 = tokio::spawn(async move {
+ // let server_address = "129.16.37.136";
+ let context_host = env::var("CONTEXTSERVICE_SERVICE_HOST")
+ .unwrap_or_else(|_| panic!("stream: Could not find context host!"));
+ let context_port = env::var("CONTEXTSERVICE_SERVICE_PORT_GRPC")
+ .unwrap_or_else(|_| panic!("stream: Could not find context port!"));
+
+ let monitoring_host = env::var("MONITORINGSERVICE_SERVICE_HOST")
+ .unwrap_or_else(|_| panic!("stream: Could not find monitoring host!"));
+ let monitoring_port = env::var("MONITORINGSERVICE_SERVICE_PORT_GRPC")
+ .unwrap_or_else(|_| panic!("stream: Could not find monitoring port!"));
+
+ let mut context_client =
+ ContextServiceClient::connect(format!("http://{}:{}", context_host, context_port))
+ .await
+ .unwrap();
+ println!("stream: Connected to the context service!");
+
+ let mut monitoring_client = MonitoringServiceClient::connect(format!(
+ "http://{}:{}",
+ monitoring_host, monitoring_port
+ ))
+ .await
+ .unwrap();
+ println!("stream: Connected to the monitoring service!");
+
+ let mut service_event_stream = context_client
+ .get_service_events(tonic::Request::new(Empty {}))
+ .await
+ .unwrap()
+ .into_inner();
+ while let Some(event) = service_event_stream.message().await.unwrap() {
+ let event_service = event.clone().service_id.unwrap();
+ if event.event.clone().unwrap().event_type == 1 {
+ println!("stream: New CREATE event:\n{:?}", event_service);
+
+ let kpi_descriptor = KpiDescriptor {
+ kpi_id: None,
+ kpi_id_list: vec![],
+ device_id: None,
+ endpoint_id: None,
+ slice_id: None,
+ connection_id: None,
+ kpi_description: format!(
+ "Latency value for service {}",
+ event_service.service_uuid.unwrap().uuid
+ ),
+ service_id: Some(event.clone().service_id.clone().unwrap().clone()),
+ kpi_sample_type: KpiSampleType::KpisampletypeUnknown.into(),
+ };
+
+ let _response = monitoring_client
+ .set_kpi(tonic::Request::new(kpi_descriptor))
+ .await
+ .unwrap()
+ .into_inner();
+ let mut kpi_id = kpi_id_trigger.lock().await;
+ println!("stream: KPI ID: {:?}", _response);
+ *kpi_id = Some(_response.clone());
+ let mut should_ping = ping_trigger.lock().await;
+ *should_ping = true;
+ } else if event.event.clone().unwrap().event_type == 3 {
+ println!("stream: New REMOVE event:\n{:?}", event);
+ let mut should_ping = ping_trigger.lock().await;
+ *should_ping = false;
+ }
+ }
+ });
+
+ futures::future::join_all(vec![t1, t2]).await;
+
+ // let addr = "10.0.0.2".parse().unwrap();
+ // let timeout = Duration::from_secs(1);
+ // ping::ping(addr, Some(timeout), Some(166), Some(3), Some(5), Some(&random())).unwrap();
+
+ // let server_address = env::var("CONTEXTSERVICE_SERVICE_HOST").unwrap();
+
+ // let contexts = grpc_client.list_context_ids(tonic::Request::new(Empty { })).await?;
+
+ // println!("{:?}", contexts.into_inner());
+ // let current_context = contexts.into_inner().context_ids[0].clone();
+
+ // if let Some(current_context) = contexts.into_inner().context_ids[0] {
+
+ // }
+ // else {
+ // panic!("No context available!");
+ // }
+
+ // for context in contexts.into_inner().context_ids {
+ // println!("{:?}", context);
+ // }
+
+ // let services = grpc_client.list_services(tonic::Request::new(current_context)).await?;
+ // println!("{:?}", services.into_inner());
+
+ println!("Hello, world!");
+
+ Ok(())
+}
diff --git a/src/tests/p4/probe/probe-tfs/src/ping.rs b/src/tests/p4/probe/probe-tfs/src/ping.rs
new file mode 100644
index 0000000000000000000000000000000000000000..3c118c98782a4cb5def9a654edbe55186bbf3df7
--- /dev/null
+++ b/src/tests/p4/probe/probe-tfs/src/ping.rs
@@ -0,0 +1,71 @@
+/**
+ * Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
+ *
+ * Program that starts the ping probe and reports it to the Unix socket.
+ *
+ * Author: Carlos Natalino
+ */
+// standard library
+use std::io;
+use std::path::Path;
+
+// external libraries
+use tokio::net::UnixStream;
+use tokio::time::{sleep, Duration};
+
+async fn send_value(path: &Path, value: i32) -> Result<(), Box> {
+ let stream = UnixStream::connect(path).await?;
+ stream.writable().await;
+ // if ready.is_writable() {
+ match stream.try_write(&i32::to_be_bytes(value)) {
+ Ok(n) => {
+ println!("\twrite {} bytes\t{}", n, value);
+ }
+ Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
+ println!("Error would block!");
+ }
+ Err(e) => {
+ println!("error into()");
+ return Err(e.into());
+ }
+ }
+ // }
+ Ok(())
+}
+
+#[tokio::main]
+async fn main() -> Result<(), Box> {
+ let path = Path::new("/tmp/tfsping");
+
+ loop {
+ let payload = [0; 1024];
+
+ let result = surge_ping::ping("10.0.0.2".parse()?, &payload).await;
+
+ // let (_packet, duration) = result.unwra
+
+ if let Ok((_packet, duration)) = result {
+ println!("Ping took {:.3?}\t{:?}", duration, _packet.get_identifier());
+ send_value(&path, duration.as_micros() as i32).await?;
+ } else {
+ println!("Error!");
+ send_value(&path, -1).await?;
+ }
+
+ sleep(Duration::from_secs(2)).await;
+ }
+
+ // Ok(()) // unreachable
+}
diff --git a/src/tests/p4/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsagent b/src/tests/p4/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsagent
new file mode 100755
index 0000000000000000000000000000000000000000..b7cef11a433c6bf2eeb94638fa90d93f25acd3c8
Binary files /dev/null and b/src/tests/p4/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsagent differ
diff --git a/src/tests/p4/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsping b/src/tests/p4/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsping
new file mode 100755
index 0000000000000000000000000000000000000000..6e943d292dd6653e857bf5eea3258d38ad246026
Binary files /dev/null and b/src/tests/p4/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsping differ
diff --git a/src/tests/p4/tests/Objects.py b/src/tests/p4/tests/Objects.py
index 29f01cd61aca58712cb0bc27b7f80c04b2f37d52..9a9b230170fb492e94bac7cb19172f623daa3394 100644
--- a/src/tests/p4/tests/Objects.py
+++ b/src/tests/p4/tests/Objects.py
@@ -59,7 +59,7 @@ DEVICE_SW1 = json_device_p4_disabled(DEVICE_SW1_UUID)
DEVICE_SW1_DPID = 1
DEVICE_SW1_NAME = DEVICE_SW1_UUID
-DEVICE_SW1_IP_ADDR = '10.0.2.10'
+DEVICE_SW1_IP_ADDR = '192.168.6.38'
DEVICE_SW1_PORT = '50001'
DEVICE_SW1_VENDOR = 'Open Networking Foundation'
DEVICE_SW1_HW_VER = 'BMv2 simple_switch'
@@ -68,12 +68,13 @@ DEVICE_SW1_SW_VER = 'Stratum'
DEVICE_SW1_BIN_PATH = '/root/p4/bmv2.json'
DEVICE_SW1_INFO_PATH = '/root/p4/p4info.txt'
-DEVICE_SW1_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', []), ('3', 'port', [])]
+DEVICE_SW1_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', []), ('3', 'port', []), ('4', 'port', [])]
DEVICE_SW1_ENDPOINTS = json_endpoints(DEVICE_SW1_ID, DEVICE_SW1_ENDPOINT_DEFS)
DEVICE_SW1_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW1_ID, DEVICE_SW1_ENDPOINT_DEFS)
ENDPOINT_ID_SW1_1 = DEVICE_SW1_ENDPOINTS[0]['endpoint_id']
ENDPOINT_ID_SW1_2 = DEVICE_SW1_ENDPOINTS[1]['endpoint_id']
ENDPOINT_ID_SW1_3 = DEVICE_SW1_ENDPOINTS[2]['endpoint_id']
+ENDPOINT_ID_SW1_4 = DEVICE_SW1_ENDPOINTS[3]['endpoint_id']
DEVICE_SW1_CONNECT_RULES = json_device_connect_rules(
DEVICE_SW1_IP_ADDR,
@@ -97,7 +98,7 @@ DEVICE_SW2 = json_device_p4_disabled(DEVICE_SW2_UUID)
DEVICE_SW2_DPID = 1
DEVICE_SW2_NAME = DEVICE_SW2_UUID
-DEVICE_SW2_IP_ADDR = '10.0.2.10'
+DEVICE_SW2_IP_ADDR = '192.168.6.38'
DEVICE_SW2_PORT = '50002'
DEVICE_SW2_VENDOR = 'Open Networking Foundation'
DEVICE_SW2_HW_VER = 'BMv2 simple_switch'
@@ -134,7 +135,7 @@ DEVICE_SW3 = json_device_p4_disabled(DEVICE_SW3_UUID)
DEVICE_SW3_DPID = 1
DEVICE_SW3_NAME = DEVICE_SW3_UUID
-DEVICE_SW3_IP_ADDR = '10.0.2.10'
+DEVICE_SW3_IP_ADDR = '192.168.6.38'
DEVICE_SW3_PORT = '50003'
DEVICE_SW3_VENDOR = 'Open Networking Foundation'
DEVICE_SW3_HW_VER = 'BMv2 simple_switch'
@@ -171,7 +172,7 @@ DEVICE_SW4 = json_device_p4_disabled(DEVICE_SW4_UUID)
DEVICE_SW4_DPID = 1
DEVICE_SW4_NAME = DEVICE_SW4_UUID
-DEVICE_SW4_IP_ADDR = '10.0.2.10'
+DEVICE_SW4_IP_ADDR = '192.168.6.38'
DEVICE_SW4_PORT = '50004'
DEVICE_SW4_VENDOR = 'Open Networking Foundation'
DEVICE_SW4_HW_VER = 'BMv2 simple_switch'
@@ -208,7 +209,7 @@ DEVICE_SW5 = json_device_p4_disabled(DEVICE_SW5_UUID)
DEVICE_SW5_DPID = 1
DEVICE_SW5_NAME = DEVICE_SW5_UUID
-DEVICE_SW5_IP_ADDR = '10.0.2.10'
+DEVICE_SW5_IP_ADDR = '192.168.6.38'
DEVICE_SW5_PORT = '50005'
DEVICE_SW5_VENDOR = 'Open Networking Foundation'
DEVICE_SW5_HW_VER = 'BMv2 simple_switch'
@@ -245,7 +246,7 @@ DEVICE_SW6 = json_device_p4_disabled(DEVICE_SW6_UUID)
DEVICE_SW6_DPID = 1
DEVICE_SW6_NAME = DEVICE_SW6_UUID
-DEVICE_SW6_IP_ADDR = '10.0.2.10'
+DEVICE_SW6_IP_ADDR = '192.168.6.38'
DEVICE_SW6_PORT = '50006'
DEVICE_SW6_VENDOR = 'Open Networking Foundation'
DEVICE_SW6_HW_VER = 'BMv2 simple_switch'
@@ -254,12 +255,11 @@ DEVICE_SW6_SW_VER = 'Stratum'
DEVICE_SW6_BIN_PATH = '/root/p4/bmv2.json'
DEVICE_SW6_INFO_PATH = '/root/p4/p4info.txt'
-DEVICE_SW6_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', []), ('3', 'port', [])]
+DEVICE_SW6_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', [])]
DEVICE_SW6_ENDPOINTS = json_endpoints(DEVICE_SW6_ID, DEVICE_SW6_ENDPOINT_DEFS)
DEVICE_SW6_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW6_ID, DEVICE_SW6_ENDPOINT_DEFS)
ENDPOINT_ID_SW6_1 = DEVICE_SW6_ENDPOINTS[0]['endpoint_id']
ENDPOINT_ID_SW6_2 = DEVICE_SW6_ENDPOINTS[1]['endpoint_id']
-ENDPOINT_ID_SW6_3 = DEVICE_SW6_ENDPOINTS[2]['endpoint_id']
DEVICE_SW6_CONNECT_RULES = json_device_connect_rules(
DEVICE_SW6_IP_ADDR,
@@ -276,42 +276,182 @@ DEVICE_SW6_CONNECT_RULES = json_device_connect_rules(
}
)
+DEVICE_SW7_UUID = 'SW7'
+DEVICE_SW7_TIMEOUT = 60
+DEVICE_SW7_ID = json_device_id(DEVICE_SW7_UUID)
+DEVICE_SW7 = json_device_p4_disabled(DEVICE_SW7_UUID)
+
+DEVICE_SW7_DPID = 1
+DEVICE_SW7_NAME = DEVICE_SW7_UUID
+DEVICE_SW7_IP_ADDR = '192.168.6.38'
+DEVICE_SW7_PORT = '50007'
+DEVICE_SW7_VENDOR = 'Open Networking Foundation'
+DEVICE_SW7_HW_VER = 'BMv2 simple_switch'
+DEVICE_SW7_SW_VER = 'Stratum'
+
+DEVICE_SW7_BIN_PATH = '/root/p4/bmv2.json'
+DEVICE_SW7_INFO_PATH = '/root/p4/p4info.txt'
+
+DEVICE_SW7_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', [])]
+DEVICE_SW7_ENDPOINTS = json_endpoints(DEVICE_SW7_ID, DEVICE_SW7_ENDPOINT_DEFS)
+DEVICE_SW7_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW7_ID, DEVICE_SW7_ENDPOINT_DEFS)
+ENDPOINT_ID_SW7_1 = DEVICE_SW7_ENDPOINTS[0]['endpoint_id']
+ENDPOINT_ID_SW7_2 = DEVICE_SW7_ENDPOINTS[1]['endpoint_id']
+
+DEVICE_SW7_CONNECT_RULES = json_device_connect_rules(
+ DEVICE_SW7_IP_ADDR,
+ DEVICE_SW7_PORT,
+ {
+ 'id': DEVICE_SW7_DPID,
+ 'name': DEVICE_SW7_NAME,
+ 'vendor': DEVICE_SW7_VENDOR,
+ 'hw_ver': DEVICE_SW7_HW_VER,
+ 'sw_ver': DEVICE_SW7_SW_VER,
+ 'timeout': DEVICE_SW7_TIMEOUT,
+ 'p4bin': DEVICE_SW7_BIN_PATH,
+ 'p4info': DEVICE_SW7_INFO_PATH
+ }
+)
+
+DEVICE_SW8_UUID = 'SW8'
+DEVICE_SW8_TIMEOUT = 60
+DEVICE_SW8_ID = json_device_id(DEVICE_SW8_UUID)
+DEVICE_SW8 = json_device_p4_disabled(DEVICE_SW8_UUID)
+
+DEVICE_SW8_DPID = 1
+DEVICE_SW8_NAME = DEVICE_SW8_UUID
+DEVICE_SW8_IP_ADDR = '192.168.6.38'
+DEVICE_SW8_PORT = '50008'
+DEVICE_SW8_VENDOR = 'Open Networking Foundation'
+DEVICE_SW8_HW_VER = 'BMv2 simple_switch'
+DEVICE_SW8_SW_VER = 'Stratum'
+
+DEVICE_SW8_BIN_PATH = '/root/p4/bmv2.json'
+DEVICE_SW8_INFO_PATH = '/root/p4/p4info.txt'
+
+DEVICE_SW8_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', []), ('3', 'port', []), ('4', 'port', [])]
+DEVICE_SW8_ENDPOINTS = json_endpoints(DEVICE_SW8_ID, DEVICE_SW8_ENDPOINT_DEFS)
+DEVICE_SW8_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW8_ID, DEVICE_SW8_ENDPOINT_DEFS)
+ENDPOINT_ID_SW8_1 = DEVICE_SW8_ENDPOINTS[0]['endpoint_id']
+ENDPOINT_ID_SW8_2 = DEVICE_SW8_ENDPOINTS[1]['endpoint_id']
+ENDPOINT_ID_SW8_3 = DEVICE_SW8_ENDPOINTS[2]['endpoint_id']
+ENDPOINT_ID_SW8_4 = DEVICE_SW8_ENDPOINTS[3]['endpoint_id']
+
+DEVICE_SW8_CONNECT_RULES = json_device_connect_rules(
+ DEVICE_SW8_IP_ADDR,
+ DEVICE_SW8_PORT,
+ {
+ 'id': DEVICE_SW8_DPID,
+ 'name': DEVICE_SW8_NAME,
+ 'vendor': DEVICE_SW8_VENDOR,
+ 'hw_ver': DEVICE_SW8_HW_VER,
+ 'sw_ver': DEVICE_SW8_SW_VER,
+ 'timeout': DEVICE_SW8_TIMEOUT,
+ 'p4bin': DEVICE_SW8_BIN_PATH,
+ 'p4info': DEVICE_SW8_INFO_PATH
+ }
+)
+
# ----- Links ----------------------------------------------------------------------------------------------------------
+
+# Leftmost links (SW1-SW{2n})
+# SW1_1 - SW2_1
LINK_SW1_SW2_UUID = get_link_uuid(ENDPOINT_ID_SW1_1, ENDPOINT_ID_SW2_1)
LINK_SW1_SW2_ID = json_link_id(LINK_SW1_SW2_UUID)
LINK_SW1_SW2 = json_link(LINK_SW1_SW2_UUID, [ENDPOINT_ID_SW1_1, ENDPOINT_ID_SW2_1])
-LINK_SW1_SW3_UUID = get_link_uuid(ENDPOINT_ID_SW1_2, ENDPOINT_ID_SW3_1)
-LINK_SW1_SW3_ID = json_link_id(LINK_SW1_SW3_UUID)
-LINK_SW1_SW3 = json_link(LINK_SW1_SW3_UUID, [ENDPOINT_ID_SW1_2, ENDPOINT_ID_SW3_1])
-
-LINK_SW2_SW4_UUID = get_link_uuid(ENDPOINT_ID_SW2_2, ENDPOINT_ID_SW4_1)
-LINK_SW2_SW4_ID = json_link_id(LINK_SW2_SW4_UUID)
-LINK_SW2_SW4 = json_link(LINK_SW2_SW4_UUID, [ENDPOINT_ID_SW2_2, ENDPOINT_ID_SW4_1])
-
-LINK_SW3_SW5_UUID = get_link_uuid(ENDPOINT_ID_SW3_2, ENDPOINT_ID_SW5_1)
-LINK_SW3_SW5_ID = json_link_id(LINK_SW3_SW5_UUID)
-LINK_SW3_SW5 = json_link(LINK_SW3_SW5_UUID, [ENDPOINT_ID_SW3_2, ENDPOINT_ID_SW5_1])
-
-LINK_SW4_SW6_UUID = get_link_uuid(ENDPOINT_ID_SW4_2, ENDPOINT_ID_SW6_1)
-LINK_SW4_SW6_ID = json_link_id(LINK_SW4_SW6_UUID)
-LINK_SW4_SW6 = json_link(LINK_SW4_SW6_UUID, [ENDPOINT_ID_SW4_2, ENDPOINT_ID_SW6_1])
-
-LINK_SW5_SW6_UUID = get_link_uuid(ENDPOINT_ID_SW5_2, ENDPOINT_ID_SW6_2)
-LINK_SW5_SW6_ID = json_link_id(LINK_SW5_SW6_UUID)
-LINK_SW5_SW6 = json_link(LINK_SW5_SW6_UUID, [ENDPOINT_ID_SW5_2, ENDPOINT_ID_SW6_2])
+# SW2_1 - SW1_1
+LINK_SW2_SW1_UUID = get_link_uuid(ENDPOINT_ID_SW2_1, ENDPOINT_ID_SW1_1)
+LINK_SW2_SW1_ID = json_link_id(LINK_SW2_SW1_UUID)
+LINK_SW2_SW1 = json_link(LINK_SW2_SW1_UUID, [ENDPOINT_ID_SW2_1, ENDPOINT_ID_SW1_1])
+
+# SW1_2 - SW4_1
+LINK_SW1_SW4_UUID = get_link_uuid(ENDPOINT_ID_SW1_2, ENDPOINT_ID_SW4_1)
+LINK_SW1_SW4_ID = json_link_id(LINK_SW1_SW4_UUID)
+LINK_SW1_SW4 = json_link(LINK_SW1_SW4_UUID, [ENDPOINT_ID_SW1_2, ENDPOINT_ID_SW4_1])
+
+# SW4_1 - SW1_2
+LINK_SW4_SW1_UUID = get_link_uuid(ENDPOINT_ID_SW4_1, ENDPOINT_ID_SW1_2)
+LINK_SW4_SW1_ID = json_link_id(LINK_SW4_SW1_UUID)
+LINK_SW4_SW1 = json_link(LINK_SW4_SW1_UUID, [ENDPOINT_ID_SW4_1, ENDPOINT_ID_SW1_2])
+
+# SW1_3 - SW6_1
+LINK_SW1_SW6_UUID = get_link_uuid(ENDPOINT_ID_SW1_3, ENDPOINT_ID_SW6_1)
+LINK_SW1_SW6_ID = json_link_id(LINK_SW1_SW6_UUID)
+LINK_SW1_SW6 = json_link(LINK_SW1_SW6_UUID, [ENDPOINT_ID_SW1_3, ENDPOINT_ID_SW6_1])
+
+# SW6_1 - SW1_3
+LINK_SW6_SW1_UUID = get_link_uuid(ENDPOINT_ID_SW6_1, ENDPOINT_ID_SW1_3)
+LINK_SW6_SW1_ID = json_link_id(LINK_SW6_SW1_UUID)
+LINK_SW6_SW1 = json_link(LINK_SW6_SW1_UUID, [ENDPOINT_ID_SW6_1, ENDPOINT_ID_SW1_3])
+
+# Middle links (SW{2n}-SW{2n+1})
+# SW2_2 - SW3_1
+LINK_SW2_SW3_UUID = get_link_uuid(ENDPOINT_ID_SW2_2, ENDPOINT_ID_SW3_1)
+LINK_SW2_SW3_ID = json_link_id(LINK_SW2_SW3_UUID)
+LINK_SW2_SW3 = json_link(LINK_SW2_SW3_UUID, [ENDPOINT_ID_SW2_2, ENDPOINT_ID_SW3_1])
+
+# SW3_1 - SW2_2
+LINK_SW3_SW2_UUID = get_link_uuid(ENDPOINT_ID_SW3_1, ENDPOINT_ID_SW2_2)
+LINK_SW3_SW2_ID = json_link_id(LINK_SW3_SW2_UUID)
+LINK_SW3_SW2 = json_link(LINK_SW3_SW2_UUID, [ENDPOINT_ID_SW3_1, ENDPOINT_ID_SW2_2])
+
+# SW4_2 - SW5_1
+LINK_SW4_SW5_UUID = get_link_uuid(ENDPOINT_ID_SW4_2, ENDPOINT_ID_SW5_1)
+LINK_SW4_SW5_ID = json_link_id(LINK_SW4_SW5_UUID)
+LINK_SW4_SW5 = json_link(LINK_SW4_SW5_UUID, [ENDPOINT_ID_SW4_2, ENDPOINT_ID_SW5_1])
+
+# SW5_1 - SW4_2
+LINK_SW5_SW4_UUID = get_link_uuid(ENDPOINT_ID_SW5_1, ENDPOINT_ID_SW4_2)
+LINK_SW5_SW4_ID = json_link_id(LINK_SW5_SW4_UUID)
+LINK_SW5_SW4 = json_link(LINK_SW5_SW4_UUID, [ENDPOINT_ID_SW5_1, ENDPOINT_ID_SW4_2])
+
+# SW6_2 - SW7_1
+LINK_SW6_SW7_UUID = get_link_uuid(ENDPOINT_ID_SW6_2, ENDPOINT_ID_SW7_1)
+LINK_SW6_SW7_ID = json_link_id(LINK_SW6_SW7_UUID)
+LINK_SW6_SW7 = json_link(LINK_SW6_SW7_UUID, [ENDPOINT_ID_SW6_2, ENDPOINT_ID_SW7_1])
+
+# SW7_1 - SW6_2
+LINK_SW7_SW6_UUID = get_link_uuid(ENDPOINT_ID_SW7_1, ENDPOINT_ID_SW6_2)
+LINK_SW7_SW6_ID = json_link_id(LINK_SW7_SW6_UUID)
+LINK_SW7_SW6 = json_link(LINK_SW7_SW6_UUID, [ENDPOINT_ID_SW7_1, ENDPOINT_ID_SW6_2])
+
+# Rightmost links (SW{2n+1}-SW8)
+# SW3_2 - SW8_1
+LINK_SW3_SW8_UUID = get_link_uuid(ENDPOINT_ID_SW3_2, ENDPOINT_ID_SW8_1)
+LINK_SW3_SW8_ID = json_link_id(LINK_SW3_SW8_UUID)
+LINK_SW3_SW8 = json_link(LINK_SW3_SW8_UUID, [ENDPOINT_ID_SW3_2, ENDPOINT_ID_SW8_1])
+
+# SW8_1 - SW3_2
+LINK_SW8_SW3_UUID = get_link_uuid(ENDPOINT_ID_SW8_1, ENDPOINT_ID_SW3_2)
+LINK_SW8_SW3_ID = json_link_id(LINK_SW8_SW3_UUID)
+LINK_SW8_SW3 = json_link(LINK_SW8_SW3_UUID, [ENDPOINT_ID_SW8_1, ENDPOINT_ID_SW3_2])
+
+# SW5_2 - SW8_2
+LINK_SW5_SW8_UUID = get_link_uuid(ENDPOINT_ID_SW5_2, ENDPOINT_ID_SW8_2)
+LINK_SW5_SW8_ID = json_link_id(LINK_SW5_SW8_UUID)
+LINK_SW5_SW8 = json_link(LINK_SW5_SW8_UUID, [ENDPOINT_ID_SW5_2, ENDPOINT_ID_SW8_2])
+
+# SW8_2 - SW8_2
+LINK_SW8_SW5_UUID = get_link_uuid(ENDPOINT_ID_SW8_2, ENDPOINT_ID_SW5_2)
+LINK_SW8_SW5_ID = json_link_id(LINK_SW8_SW5_UUID)
+LINK_SW8_SW5 = json_link(LINK_SW8_SW5_UUID, [ENDPOINT_ID_SW8_2, ENDPOINT_ID_SW5_2])
+
+# SW7_2 - SW8_3
+LINK_SW7_SW8_UUID = get_link_uuid(ENDPOINT_ID_SW7_2, ENDPOINT_ID_SW8_3)
+LINK_SW7_SW8_ID = json_link_id(LINK_SW7_SW8_UUID)
+LINK_SW7_SW8 = json_link(LINK_SW7_SW8_UUID, [ENDPOINT_ID_SW7_2, ENDPOINT_ID_SW8_3])
+
+# SW8_3 - SW7_2
+LINK_SW8_SW7_UUID = get_link_uuid(ENDPOINT_ID_SW8_3, ENDPOINT_ID_SW7_2)
+LINK_SW8_SW7_ID = json_link_id(LINK_SW8_SW7_UUID)
+LINK_SW8_SW7 = json_link(LINK_SW8_SW7_UUID, [ENDPOINT_ID_SW8_3, ENDPOINT_ID_SW7_2])
# ----- Service ----------------------------------------------------------------------------------------------------------
-#SERVICE_SW1_UUID = get_service_uuid(ENDPOINT_ID_SW1_1, ENDPOINT_ID_SW1_2)
-#SERVICE_SW1 = json_service_p4_planned(SERVICE_SW1_UUID)
-
-#SERVICE_SW2_UUID = get_service_uuid(ENDPOINT_ID_SW2_1, ENDPOINT_ID_SW2_2)
-#SERVICE_SW2 = json_service_p4_planned(SERVICE_SW2_UUID)
-
-SERVICE_SW1_SW6_UUID = get_service_uuid(ENDPOINT_ID_SW1_3, ENDPOINT_ID_SW6_3)
-SERVICE_SW1_SW6 = json_service_p4_planned(SERVICE_SW1_SW6_UUID)
-SERVICE_SW1_SW6_ENDPOINT_IDS = [DEVICE_SW1_ENDPOINT_IDS[2], DEVICE_SW6_ENDPOINT_IDS[2]]
+SERVICE_SW1_SW8_UUID = get_service_uuid(ENDPOINT_ID_SW1_4, ENDPOINT_ID_SW8_4)
+SERVICE_SW1_SW8 = json_service_p4_planned(SERVICE_SW1_SW8_UUID)
+SERVICE_SW1_SW8_ENDPOINT_IDS = [DEVICE_SW1_ENDPOINT_IDS[3], DEVICE_SW8_ENDPOINT_IDS[3]]
# ----- Object Collections ---------------------------------------------------------------------------------------------
@@ -325,21 +465,36 @@ DEVICES = [
(DEVICE_SW4, DEVICE_SW4_CONNECT_RULES, DEVICE_SW4_ENDPOINTS),
(DEVICE_SW5, DEVICE_SW5_CONNECT_RULES, DEVICE_SW5_ENDPOINTS),
(DEVICE_SW6, DEVICE_SW6_CONNECT_RULES, DEVICE_SW6_ENDPOINTS),
+ (DEVICE_SW7, DEVICE_SW7_CONNECT_RULES, DEVICE_SW7_ENDPOINTS),
+ (DEVICE_SW8, DEVICE_SW8_CONNECT_RULES, DEVICE_SW8_ENDPOINTS),
]
LINKS = [
LINK_SW1_SW2,
- LINK_SW1_SW3,
+ LINK_SW1_SW4,
+ LINK_SW1_SW6,
- LINK_SW2_SW4,
- LINK_SW3_SW5,
+ LINK_SW2_SW3,
+ LINK_SW4_SW5,
+ LINK_SW6_SW7,
- LINK_SW4_SW6,
- LINK_SW5_SW6
- ]
+ LINK_SW3_SW8,
+ LINK_SW5_SW8,
+ LINK_SW7_SW8,
-#SERVICES = [(SERVICE_SW1, DEVICE_SW1_ENDPOINT_IDS), (SERVICE_SW2, DEVICE_SW2_ENDPOINT_IDS)]
+ LINK_SW2_SW1,
+ LINK_SW4_SW1,
+ LINK_SW6_SW1,
-#SERVICE_SW1_SW2_ENDPOINT_IDS = DEVICE_SW1_ENDPOINT_IDS + DEVICE_SW2_ENDPOINT_IDS
+ LINK_SW3_SW2,
+ LINK_SW5_SW4,
+ LINK_SW7_SW6,
-SERVICES = [(SERVICE_SW1_SW6, SERVICE_SW1_SW6_ENDPOINT_IDS)]
\ No newline at end of file
+ LINK_SW8_SW3,
+ LINK_SW8_SW5,
+ LINK_SW8_SW7,
+]
+
+SERVICES = [
+ (SERVICE_SW1_SW8, SERVICE_SW1_SW8_ENDPOINT_IDS),
+]
diff --git a/src/tests/p4/tests/topologies/6switchObjects.py b/src/tests/p4/tests/topologies/6switchObjects.py
new file mode 100644
index 0000000000000000000000000000000000000000..29f01cd61aca58712cb0bc27b7f80c04b2f37d52
--- /dev/null
+++ b/src/tests/p4/tests/topologies/6switchObjects.py
@@ -0,0 +1,345 @@
+# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (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.
+
+import os
+from typing import Dict, List, Tuple
+from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME
+from common.tools.object_factory.Context import json_context, json_context_id
+from common.tools.object_factory.Device import (
+ json_device_connect_rules, json_device_emulated_connect_rules, json_device_emulated_packet_router_disabled,
+ json_device_connect_rules, json_device_id, json_device_p4_disabled,
+ json_device_emulated_tapi_disabled, json_device_id, json_device_packetrouter_disabled, json_device_tapi_disabled)
+from common.tools.object_factory.Service import (
+ get_service_uuid, json_service_l3nm_planned,json_service_p4_planned)
+from common.tools.object_factory.ConfigRule import (
+ json_config_rule_set, json_config_rule_delete)
+from common.tools.object_factory.EndPoint import json_endpoint, json_endpoint_ids, json_endpoints, json_endpoint_id
+from common.tools.object_factory.Link import get_link_uuid, json_link, json_link_id
+from common.tools.object_factory.Topology import json_topology, json_topology_id
+from common.proto.kpi_sample_types_pb2 import KpiSampleType
+
+# ----- Context --------------------------------------------------------------------------------------------------------
+CONTEXT_ID = json_context_id(DEFAULT_CONTEXT_NAME)
+CONTEXT = json_context(DEFAULT_CONTEXT_NAME)
+
+# ----- Topology -------------------------------------------------------------------------------------------------------
+TOPOLOGY_ID = json_topology_id(DEFAULT_TOPOLOGY_NAME, context_id=CONTEXT_ID)
+TOPOLOGY = json_topology(DEFAULT_TOPOLOGY_NAME, context_id=CONTEXT_ID)
+
+# ----- Monitoring Samples ---------------------------------------------------------------------------------------------
+PACKET_PORT_SAMPLE_TYPES = [
+ KpiSampleType.KPISAMPLETYPE_PACKETS_TRANSMITTED,
+ KpiSampleType.KPISAMPLETYPE_PACKETS_RECEIVED,
+ KpiSampleType.KPISAMPLETYPE_BYTES_TRANSMITTED,
+ KpiSampleType.KPISAMPLETYPE_BYTES_RECEIVED,
+]
+
+# ----- Device Credentials and Settings --------------------------------------------------------------------------------
+
+
+# ----- Devices --------------------------------------------------------------------------------------------------------
+
+CUR_PATH = os.path.dirname(os.path.abspath(__file__))
+
+DEVICE_SW1_UUID = 'SW1'
+DEVICE_SW1_TIMEOUT = 60
+DEVICE_SW1_ID = json_device_id(DEVICE_SW1_UUID)
+DEVICE_SW1 = json_device_p4_disabled(DEVICE_SW1_UUID)
+
+DEVICE_SW1_DPID = 1
+DEVICE_SW1_NAME = DEVICE_SW1_UUID
+DEVICE_SW1_IP_ADDR = '10.0.2.10'
+DEVICE_SW1_PORT = '50001'
+DEVICE_SW1_VENDOR = 'Open Networking Foundation'
+DEVICE_SW1_HW_VER = 'BMv2 simple_switch'
+DEVICE_SW1_SW_VER = 'Stratum'
+
+DEVICE_SW1_BIN_PATH = '/root/p4/bmv2.json'
+DEVICE_SW1_INFO_PATH = '/root/p4/p4info.txt'
+
+DEVICE_SW1_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', []), ('3', 'port', [])]
+DEVICE_SW1_ENDPOINTS = json_endpoints(DEVICE_SW1_ID, DEVICE_SW1_ENDPOINT_DEFS)
+DEVICE_SW1_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW1_ID, DEVICE_SW1_ENDPOINT_DEFS)
+ENDPOINT_ID_SW1_1 = DEVICE_SW1_ENDPOINTS[0]['endpoint_id']
+ENDPOINT_ID_SW1_2 = DEVICE_SW1_ENDPOINTS[1]['endpoint_id']
+ENDPOINT_ID_SW1_3 = DEVICE_SW1_ENDPOINTS[2]['endpoint_id']
+
+DEVICE_SW1_CONNECT_RULES = json_device_connect_rules(
+ DEVICE_SW1_IP_ADDR,
+ DEVICE_SW1_PORT,
+ {
+ 'id': DEVICE_SW1_DPID,
+ 'name': DEVICE_SW1_NAME,
+ 'vendor': DEVICE_SW1_VENDOR,
+ 'hw_ver': DEVICE_SW1_HW_VER,
+ 'sw_ver': DEVICE_SW1_SW_VER,
+ 'timeout': DEVICE_SW1_TIMEOUT,
+ 'p4bin': DEVICE_SW1_BIN_PATH,
+ 'p4info': DEVICE_SW1_INFO_PATH
+ }
+)
+
+DEVICE_SW2_UUID = 'SW2'
+DEVICE_SW2_TIMEOUT = 60
+DEVICE_SW2_ID = json_device_id(DEVICE_SW2_UUID)
+DEVICE_SW2 = json_device_p4_disabled(DEVICE_SW2_UUID)
+
+DEVICE_SW2_DPID = 1
+DEVICE_SW2_NAME = DEVICE_SW2_UUID
+DEVICE_SW2_IP_ADDR = '10.0.2.10'
+DEVICE_SW2_PORT = '50002'
+DEVICE_SW2_VENDOR = 'Open Networking Foundation'
+DEVICE_SW2_HW_VER = 'BMv2 simple_switch'
+DEVICE_SW2_SW_VER = 'Stratum'
+
+DEVICE_SW2_BIN_PATH = '/root/p4/bmv2.json'
+DEVICE_SW2_INFO_PATH = '/root/p4/p4info.txt'
+
+DEVICE_SW2_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', [])]
+DEVICE_SW2_ENDPOINTS = json_endpoints(DEVICE_SW2_ID, DEVICE_SW2_ENDPOINT_DEFS)
+DEVICE_SW2_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW2_ID, DEVICE_SW2_ENDPOINT_DEFS)
+ENDPOINT_ID_SW2_1 = DEVICE_SW2_ENDPOINTS[0]['endpoint_id']
+ENDPOINT_ID_SW2_2 = DEVICE_SW2_ENDPOINTS[1]['endpoint_id']
+
+DEVICE_SW2_CONNECT_RULES = json_device_connect_rules(
+ DEVICE_SW2_IP_ADDR,
+ DEVICE_SW2_PORT,
+ {
+ 'id': DEVICE_SW2_DPID,
+ 'name': DEVICE_SW2_NAME,
+ 'vendor': DEVICE_SW2_VENDOR,
+ 'hw_ver': DEVICE_SW2_HW_VER,
+ 'sw_ver': DEVICE_SW2_SW_VER,
+ 'timeout': DEVICE_SW2_TIMEOUT,
+ 'p4bin': DEVICE_SW2_BIN_PATH,
+ 'p4info': DEVICE_SW2_INFO_PATH
+ }
+)
+
+DEVICE_SW3_UUID = 'SW3'
+DEVICE_SW3_TIMEOUT = 60
+DEVICE_SW3_ID = json_device_id(DEVICE_SW3_UUID)
+DEVICE_SW3 = json_device_p4_disabled(DEVICE_SW3_UUID)
+
+DEVICE_SW3_DPID = 1
+DEVICE_SW3_NAME = DEVICE_SW3_UUID
+DEVICE_SW3_IP_ADDR = '10.0.2.10'
+DEVICE_SW3_PORT = '50003'
+DEVICE_SW3_VENDOR = 'Open Networking Foundation'
+DEVICE_SW3_HW_VER = 'BMv2 simple_switch'
+DEVICE_SW3_SW_VER = 'Stratum'
+
+DEVICE_SW3_BIN_PATH = '/root/p4/bmv2.json'
+DEVICE_SW3_INFO_PATH = '/root/p4/p4info.txt'
+
+DEVICE_SW3_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', [])]
+DEVICE_SW3_ENDPOINTS = json_endpoints(DEVICE_SW3_ID, DEVICE_SW3_ENDPOINT_DEFS)
+DEVICE_SW3_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW3_ID, DEVICE_SW3_ENDPOINT_DEFS)
+ENDPOINT_ID_SW3_1 = DEVICE_SW3_ENDPOINTS[0]['endpoint_id']
+ENDPOINT_ID_SW3_2 = DEVICE_SW3_ENDPOINTS[1]['endpoint_id']
+
+DEVICE_SW3_CONNECT_RULES = json_device_connect_rules(
+ DEVICE_SW3_IP_ADDR,
+ DEVICE_SW3_PORT,
+ {
+ 'id': DEVICE_SW3_DPID,
+ 'name': DEVICE_SW3_NAME,
+ 'vendor': DEVICE_SW3_VENDOR,
+ 'hw_ver': DEVICE_SW3_HW_VER,
+ 'sw_ver': DEVICE_SW3_SW_VER,
+ 'timeout': DEVICE_SW3_TIMEOUT,
+ 'p4bin': DEVICE_SW3_BIN_PATH,
+ 'p4info': DEVICE_SW3_INFO_PATH
+ }
+)
+
+DEVICE_SW4_UUID = 'SW4'
+DEVICE_SW4_TIMEOUT = 60
+DEVICE_SW4_ID = json_device_id(DEVICE_SW4_UUID)
+DEVICE_SW4 = json_device_p4_disabled(DEVICE_SW4_UUID)
+
+DEVICE_SW4_DPID = 1
+DEVICE_SW4_NAME = DEVICE_SW4_UUID
+DEVICE_SW4_IP_ADDR = '10.0.2.10'
+DEVICE_SW4_PORT = '50004'
+DEVICE_SW4_VENDOR = 'Open Networking Foundation'
+DEVICE_SW4_HW_VER = 'BMv2 simple_switch'
+DEVICE_SW4_SW_VER = 'Stratum'
+
+DEVICE_SW4_BIN_PATH = '/root/p4/bmv2.json'
+DEVICE_SW4_INFO_PATH = '/root/p4/p4info.txt'
+
+DEVICE_SW4_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', [])]
+DEVICE_SW4_ENDPOINTS = json_endpoints(DEVICE_SW4_ID, DEVICE_SW4_ENDPOINT_DEFS)
+DEVICE_SW4_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW4_ID, DEVICE_SW4_ENDPOINT_DEFS)
+ENDPOINT_ID_SW4_1 = DEVICE_SW4_ENDPOINTS[0]['endpoint_id']
+ENDPOINT_ID_SW4_2 = DEVICE_SW4_ENDPOINTS[1]['endpoint_id']
+
+DEVICE_SW4_CONNECT_RULES = json_device_connect_rules(
+ DEVICE_SW4_IP_ADDR,
+ DEVICE_SW4_PORT,
+ {
+ 'id': DEVICE_SW4_DPID,
+ 'name': DEVICE_SW4_NAME,
+ 'vendor': DEVICE_SW4_VENDOR,
+ 'hw_ver': DEVICE_SW4_HW_VER,
+ 'sw_ver': DEVICE_SW4_SW_VER,
+ 'timeout': DEVICE_SW4_TIMEOUT,
+ 'p4bin': DEVICE_SW4_BIN_PATH,
+ 'p4info': DEVICE_SW4_INFO_PATH
+ }
+)
+
+DEVICE_SW5_UUID = 'SW5'
+DEVICE_SW5_TIMEOUT = 60
+DEVICE_SW5_ID = json_device_id(DEVICE_SW5_UUID)
+DEVICE_SW5 = json_device_p4_disabled(DEVICE_SW5_UUID)
+
+DEVICE_SW5_DPID = 1
+DEVICE_SW5_NAME = DEVICE_SW5_UUID
+DEVICE_SW5_IP_ADDR = '10.0.2.10'
+DEVICE_SW5_PORT = '50005'
+DEVICE_SW5_VENDOR = 'Open Networking Foundation'
+DEVICE_SW5_HW_VER = 'BMv2 simple_switch'
+DEVICE_SW5_SW_VER = 'Stratum'
+
+DEVICE_SW5_BIN_PATH = '/root/p4/bmv2.json'
+DEVICE_SW5_INFO_PATH = '/root/p4/p4info.txt'
+
+DEVICE_SW5_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', [])]
+DEVICE_SW5_ENDPOINTS = json_endpoints(DEVICE_SW5_ID, DEVICE_SW5_ENDPOINT_DEFS)
+DEVICE_SW5_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW5_ID, DEVICE_SW5_ENDPOINT_DEFS)
+ENDPOINT_ID_SW5_1 = DEVICE_SW5_ENDPOINTS[0]['endpoint_id']
+ENDPOINT_ID_SW5_2 = DEVICE_SW5_ENDPOINTS[1]['endpoint_id']
+
+DEVICE_SW5_CONNECT_RULES = json_device_connect_rules(
+ DEVICE_SW5_IP_ADDR,
+ DEVICE_SW5_PORT,
+ {
+ 'id': DEVICE_SW5_DPID,
+ 'name': DEVICE_SW5_NAME,
+ 'vendor': DEVICE_SW5_VENDOR,
+ 'hw_ver': DEVICE_SW5_HW_VER,
+ 'sw_ver': DEVICE_SW5_SW_VER,
+ 'timeout': DEVICE_SW5_TIMEOUT,
+ 'p4bin': DEVICE_SW5_BIN_PATH,
+ 'p4info': DEVICE_SW5_INFO_PATH
+ }
+)
+
+DEVICE_SW6_UUID = 'SW6'
+DEVICE_SW6_TIMEOUT = 60
+DEVICE_SW6_ID = json_device_id(DEVICE_SW6_UUID)
+DEVICE_SW6 = json_device_p4_disabled(DEVICE_SW6_UUID)
+
+DEVICE_SW6_DPID = 1
+DEVICE_SW6_NAME = DEVICE_SW6_UUID
+DEVICE_SW6_IP_ADDR = '10.0.2.10'
+DEVICE_SW6_PORT = '50006'
+DEVICE_SW6_VENDOR = 'Open Networking Foundation'
+DEVICE_SW6_HW_VER = 'BMv2 simple_switch'
+DEVICE_SW6_SW_VER = 'Stratum'
+
+DEVICE_SW6_BIN_PATH = '/root/p4/bmv2.json'
+DEVICE_SW6_INFO_PATH = '/root/p4/p4info.txt'
+
+DEVICE_SW6_ENDPOINT_DEFS = [('1', 'port', []), ('2', 'port', []), ('3', 'port', [])]
+DEVICE_SW6_ENDPOINTS = json_endpoints(DEVICE_SW6_ID, DEVICE_SW6_ENDPOINT_DEFS)
+DEVICE_SW6_ENDPOINT_IDS = json_endpoint_ids(DEVICE_SW6_ID, DEVICE_SW6_ENDPOINT_DEFS)
+ENDPOINT_ID_SW6_1 = DEVICE_SW6_ENDPOINTS[0]['endpoint_id']
+ENDPOINT_ID_SW6_2 = DEVICE_SW6_ENDPOINTS[1]['endpoint_id']
+ENDPOINT_ID_SW6_3 = DEVICE_SW6_ENDPOINTS[2]['endpoint_id']
+
+DEVICE_SW6_CONNECT_RULES = json_device_connect_rules(
+ DEVICE_SW6_IP_ADDR,
+ DEVICE_SW6_PORT,
+ {
+ 'id': DEVICE_SW6_DPID,
+ 'name': DEVICE_SW6_NAME,
+ 'vendor': DEVICE_SW6_VENDOR,
+ 'hw_ver': DEVICE_SW6_HW_VER,
+ 'sw_ver': DEVICE_SW6_SW_VER,
+ 'timeout': DEVICE_SW6_TIMEOUT,
+ 'p4bin': DEVICE_SW6_BIN_PATH,
+ 'p4info': DEVICE_SW6_INFO_PATH
+ }
+)
+
+# ----- Links ----------------------------------------------------------------------------------------------------------
+LINK_SW1_SW2_UUID = get_link_uuid(ENDPOINT_ID_SW1_1, ENDPOINT_ID_SW2_1)
+LINK_SW1_SW2_ID = json_link_id(LINK_SW1_SW2_UUID)
+LINK_SW1_SW2 = json_link(LINK_SW1_SW2_UUID, [ENDPOINT_ID_SW1_1, ENDPOINT_ID_SW2_1])
+
+LINK_SW1_SW3_UUID = get_link_uuid(ENDPOINT_ID_SW1_2, ENDPOINT_ID_SW3_1)
+LINK_SW1_SW3_ID = json_link_id(LINK_SW1_SW3_UUID)
+LINK_SW1_SW3 = json_link(LINK_SW1_SW3_UUID, [ENDPOINT_ID_SW1_2, ENDPOINT_ID_SW3_1])
+
+LINK_SW2_SW4_UUID = get_link_uuid(ENDPOINT_ID_SW2_2, ENDPOINT_ID_SW4_1)
+LINK_SW2_SW4_ID = json_link_id(LINK_SW2_SW4_UUID)
+LINK_SW2_SW4 = json_link(LINK_SW2_SW4_UUID, [ENDPOINT_ID_SW2_2, ENDPOINT_ID_SW4_1])
+
+LINK_SW3_SW5_UUID = get_link_uuid(ENDPOINT_ID_SW3_2, ENDPOINT_ID_SW5_1)
+LINK_SW3_SW5_ID = json_link_id(LINK_SW3_SW5_UUID)
+LINK_SW3_SW5 = json_link(LINK_SW3_SW5_UUID, [ENDPOINT_ID_SW3_2, ENDPOINT_ID_SW5_1])
+
+LINK_SW4_SW6_UUID = get_link_uuid(ENDPOINT_ID_SW4_2, ENDPOINT_ID_SW6_1)
+LINK_SW4_SW6_ID = json_link_id(LINK_SW4_SW6_UUID)
+LINK_SW4_SW6 = json_link(LINK_SW4_SW6_UUID, [ENDPOINT_ID_SW4_2, ENDPOINT_ID_SW6_1])
+
+LINK_SW5_SW6_UUID = get_link_uuid(ENDPOINT_ID_SW5_2, ENDPOINT_ID_SW6_2)
+LINK_SW5_SW6_ID = json_link_id(LINK_SW5_SW6_UUID)
+LINK_SW5_SW6 = json_link(LINK_SW5_SW6_UUID, [ENDPOINT_ID_SW5_2, ENDPOINT_ID_SW6_2])
+
+# ----- Service ----------------------------------------------------------------------------------------------------------
+
+#SERVICE_SW1_UUID = get_service_uuid(ENDPOINT_ID_SW1_1, ENDPOINT_ID_SW1_2)
+#SERVICE_SW1 = json_service_p4_planned(SERVICE_SW1_UUID)
+
+#SERVICE_SW2_UUID = get_service_uuid(ENDPOINT_ID_SW2_1, ENDPOINT_ID_SW2_2)
+#SERVICE_SW2 = json_service_p4_planned(SERVICE_SW2_UUID)
+
+SERVICE_SW1_SW6_UUID = get_service_uuid(ENDPOINT_ID_SW1_3, ENDPOINT_ID_SW6_3)
+SERVICE_SW1_SW6 = json_service_p4_planned(SERVICE_SW1_SW6_UUID)
+SERVICE_SW1_SW6_ENDPOINT_IDS = [DEVICE_SW1_ENDPOINT_IDS[2], DEVICE_SW6_ENDPOINT_IDS[2]]
+
+# ----- Object Collections ---------------------------------------------------------------------------------------------
+
+CONTEXTS = [CONTEXT]
+TOPOLOGIES = [TOPOLOGY]
+
+DEVICES = [
+ (DEVICE_SW1, DEVICE_SW1_CONNECT_RULES, DEVICE_SW1_ENDPOINTS),
+ (DEVICE_SW2, DEVICE_SW2_CONNECT_RULES, DEVICE_SW2_ENDPOINTS),
+ (DEVICE_SW3, DEVICE_SW3_CONNECT_RULES, DEVICE_SW3_ENDPOINTS),
+ (DEVICE_SW4, DEVICE_SW4_CONNECT_RULES, DEVICE_SW4_ENDPOINTS),
+ (DEVICE_SW5, DEVICE_SW5_CONNECT_RULES, DEVICE_SW5_ENDPOINTS),
+ (DEVICE_SW6, DEVICE_SW6_CONNECT_RULES, DEVICE_SW6_ENDPOINTS),
+]
+
+LINKS = [
+ LINK_SW1_SW2,
+ LINK_SW1_SW3,
+
+ LINK_SW2_SW4,
+ LINK_SW3_SW5,
+
+ LINK_SW4_SW6,
+ LINK_SW5_SW6
+ ]
+
+#SERVICES = [(SERVICE_SW1, DEVICE_SW1_ENDPOINT_IDS), (SERVICE_SW2, DEVICE_SW2_ENDPOINT_IDS)]
+
+#SERVICE_SW1_SW2_ENDPOINT_IDS = DEVICE_SW1_ENDPOINT_IDS + DEVICE_SW2_ENDPOINT_IDS
+
+SERVICES = [(SERVICE_SW1_SW6, SERVICE_SW1_SW6_ENDPOINT_IDS)]
\ No newline at end of file