Skip to content
Antonio Gomez Vergara edited this page Jun 8, 2017 · 4 revisions

Autogenerate code with swagger:

In order to autogenerate the code with Swagger, we will use Linux and the JSON template of CTTC (TapiTopology.swagger). Swagger generator is needed, you can download it with:

wget https://oss.sonatype.org/content/repositories/releases/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar

Then, the instruction to autogenerate the code with the prior client is:

java -jar swagger-codegen-cli-2.2.1.jar generate -i /home/username/swagger/TapiTopology.swagger -l jaxrs -o tapi-network/ --api-package es.tid.topologyModuleBase.TAPITopoModel.api --model-package es.tid.topologyModuleBase.TAPITopoModel.model

The process is going to take a few seconds and it will create a tapi-network folder where the code is. The code can be compiled following the README instructions.

Import the autogenerated code to the project:

In first place, we need to compare the dependencies and versions of the properties in the pom.xml files, also the netphony-topology and the our tapi-network folder.

In second place, we need to copy the files of the packages in the tapi-network folder to the netphony-topology project. If such import has been successful, the project should be compiled without any errors.

Generate the writer plugin (exporter):

Inside of es.tid.topologyModuleBase.plugins.writer package, create a new plugin called TopologyServerTAPI.java. We will use as template the TopologyServerCOP.java

Topology XML:

In order to try the BGP-LS plugin we will use the already configured scenario TriangleSSON_B (/home/tid/scenarios/TriangleSSON_B) and the logs located at /home/tid/log/TriangleSSON_B/out_TriangleSSON_B.log.

The XML topology descriptor for the PCE is located in:

/usr/local/nodeConfig/topología.xml (There are more topologies here).

Also, the topology XML of the scenario is located in:

/home/tid/scenarios/TriangleSSON_B/nodeConfig/topología.xml

The behavior of the plugin is based on send topologies within PCEs through BGP-LS and export it to TAPI, where a single PCE learns the topology from an XML file and the rest of PCEs learn from BGP-LS plugin:

Tests:

In order to try the communication with the 3 networks (TM1, TM2 and TM3), we will execute the instruction:

mvn package –P generate-full-jar On a virtual machine (Maven has to be installed), and once the instruction has compiled, we need 3 shells to execute the following instructions, each one in a different shell: sudo java -Dlog4j.configurationFile=target/log4j2.xml -jar target/topology-1.3.3-shaded.jar target/example3tapi/TM1.xml

sudo java -Dlog4j.configurationFile=target/log4j2.xml -jar target/topology-1.3.3-shaded.jar target/example3tapi/TM2.xml

sudo java -Dlog4j.configurationFile=target/log4j2.xml -jar target/topology-1.3.3-shaded.jar target/example3tapi/TM3.xml

Now we can try if there is communication between the 3 topologies, on a new shell, we make the curls:

curl http://localhost:8187/restconf/data/virtualizer/

curl http://localhost:8187/restconf/config/Context/_topology/

We need to be careful and look in the TMx.xml (netphony-topology\src\main\sample-config-files) files the IP and port that we defined in the XML files, adding the following tags along with the TAPI listening port:

<TAPI> <server_port> </server_port> </TAPI>