How can I change my topology using RESTCONF commands?


Carlos Martins <carlosmartinsufu@...>
 

Hello everyone!!!

I need your help about MDSAL.

I am creating a college project with ODL(Oxygen - karaf 0.8.0) + MININET (2.2.1) and I have installed the features:

1) odl-restconf-all, odl-dluxapps-topology, odl-l2switch-switch-ui,  and odl-netconf-connector-all

2) running the mininet like mn --topo linear,3 --controller=remote,ip=<MY_IP>,port=6633 --switch ovs

However, I am unable to get the config data store to put or delete links of the topology.

For example:

The link

1) GET  http://localhost:8181/restconf/operational/network-topology:network-topology -> Works, return all topology
2) GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Works, return my link openflow:2:3

But

3) GET http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3  - > Does not work, return error

error-message": "Request could not be completed because the relevant data model content does not exist "

and

4) DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Does not work, return error
 
 "error-message": "Data does not exist for path: /(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology/topology/topology[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology-id=flow:1}]/link/link[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)link-id=openflow:2:3}]"
 
 
OBS:
 
1) My topology is created by MININET and odl-l2switch-switch-ui inside DLUX UI;
2) Anyone link in the config path in RESTCONF does not work ( http://localhost:8181/restconf/config/*);
3) I am using curl commands like;

curl -H "Content-Type: application/xml" -u admin:admin -X DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3
 
So, how can I change my topology using RESTCONF commands?

Thanks !!!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Tejas Nevrekar
 

Hi Carlos,

Note that the topology is always discovered from mininet and hence will always be in /restconf/operational. More details on how this works is https://docs.opendaylight.org/projects/openflowplugin/en/latest/users/operation.html

Quick answer is there is no easy way by which you can update what's in /restconf/operational by writing to /restconf/config/....

However, you can write to the /restconf/config/network-topology:network-topology/topology/flow:1 by constructing the full payload containing nodes/links. A simple way to do that is to do a GET  /restconf/operational/network-topology:network-topology/topology/flow:1 and provide the output of that in a PUT to  /restconf/config/network-topology:network-topology/topology/flow:1.

Please let us know if this helped.

Regards,

-Tejas.
 

On Thu, Jul 23, 2020 at 10:42 AM Carlos Martins via lists.opendaylight.org <carlosmartinsufu=yahoo.com.br@...> wrote:

Hello everyone!!!

I need your help about MDSAL.

I am creating a college project with ODL(Oxygen - karaf 0.8.0) + MININET (2.2.1) and I have installed the features:

1) odl-restconf-all, odl-dluxapps-topology, odl-l2switch-switch-ui,  and odl-netconf-connector-all

2) running the mininet like mn --topo linear,3 --controller=remote,ip=<MY_IP>,port=6633 --switch ovs

However, I am unable to get the config data store to put or delete links of the topology.

For example:

The link

1) GET  http://localhost:8181/restconf/operational/network-topology:network-topology -> Works, return all topology
2) GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Works, return my link openflow:2:3

But

3) GET http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3  - > Does not work, return error

error-message": "Request could not be completed because the relevant data model content does not exist "

and

4) DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Does not work, return error
 
 "error-message": "Data does not exist for path: /(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology/topology/topology[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology-id=flow:1}]/link/link[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)link-id=openflow:2:3}]"
 
 
OBS:
 
1) My topology is created by MININET and odl-l2switch-switch-ui inside DLUX UI;
2) Anyone link in the config path in RESTCONF does not work ( http://localhost:8181/restconf/config/*);
3) I am using curl commands like;

curl -H "Content-Type: application/xml" -u admin:admin -X DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3
 
So, how can I change my topology using RESTCONF commands?

Thanks !!!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Luis Gomez
 

Just want to clarify that OFP project only provides operational topology:  /restconf/operational/network-topology:network-topology/topology/flow:1 that BTW cannot be modified by user because this is discovered using LLDP packets as described in the docs. I am not sure what is the purpose of reading/writting in the config topology: /restconf/configuration/network-topology:network-topology/topology/flow:1, but whatever it is, it is not implemented in ODL.

BR/Luis


On Jul 23, 2020, at 10:27 AM, Tejas Nevrekar <tejas.nevrekar@...> wrote:

Hi Carlos,

Note that the topology is always discovered from mininet and hence will always be in /restconf/operational. More details on how this works is https://docs.opendaylight.org/projects/openflowplugin/en/latest/users/operation.html

Quick answer is there is no easy way by which you can update what's in /restconf/operational by writing to /restconf/config/....

However, you can write to the /restconf/config/network-topology:network-topology/topology/flow:1 by constructing the full payload containing nodes/links. A simple way to do that is to do a GET  /restconf/operational/network-topology:network-topology/topology/flow:1 and provide the output of that in a PUT to  /restconf/config/network-topology:network-topology/topology/flow:1.

Please let us know if this helped.

Regards,

-Tejas.
 

On Thu, Jul 23, 2020 at 10:42 AM Carlos Martins via lists.opendaylight.org<carlosmartinsufu=yahoo.com.br@...> wrote:
Hello everyone!!!

I need your help about MDSAL. 

I am creating a college project with ODL(Oxygen - karaf 0.8.0) + MININET (2.2.1) and I have installed the features:

1) odl-restconf-all, odl-dluxapps-topology, odl-l2switch-switch-ui,  and odl-netconf-connector-all

2) running the mininet like mn --topo linear,3 --controller=remote,ip=<MY_IP>,port=6633 --switch ovs

However, I am unable to get the config data store to put or delete links of the topology.

For example:

The link 

1) GET  http://localhost:8181/restconf/operational/network-topology:network-topology -> Works, return all topology
2) GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Works, return my link openflow:2:3 

But 

3) GET http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3  - > Does not work, return error 

error-message": "Request could not be completed because the relevant data model content does not exist "

and 

4) DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Does not work, return error
 
 "error-message": "Data does not exist for path: /(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology/topology/topology[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology-id=flow:1}]/link/link[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)link-id=openflow:2:3}]"
 
 
OBS: 
 
1) My topology is created by MININET and odl-l2switch-switch-ui inside DLUX UI;
2) Anyone link in the config path in RESTCONF does not work ( http://localhost:8181/restconf/config/*);
3) I am using curl commands like;

curl -H "Content-Type: application/xml" -u admin:admin -X DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3
 
So, how can I change my topology using RESTCONF commands?

Thanks !!!


----------------------------------------------- 
Carlos Martins

carlosmartinsufu@...  

-----------------------------------------------



Robert Varga
 

On 23/07/2020 20:21, Luis Gomez wrote:
I am not sure what is the purpose of reading/writting in the config
topology:
/restconf/configuration/network-topology:network-topology/topology/flow:1,
but whatever it is, it is not implemented in ODL.
If I were to venture a guess, the intent *might* be to populate flows
via FRM, but if memory serves that part is being done via inventory ...
(and I am out of my depth here).

Regards,
Robert


Tejas Nevrekar
 

Hi Carlos,

Did you get to try what i suggested below?

Regards,
Tejas

On Sat, Jul 25, 2020 at 10:16 AM Carlos Martins <carlosmartinsufu@...> wrote:
Hi All,

Basically, I need of modify the topology like described below:

1) I have an ODL module that listens to all LLDP packets. So, each LLDP packet is stored within the database in the form of (ip_controller,src_mac,src_port,dst_mac,dst_port);

2) I have an second module that reads this information and does an analysis of time to time to find Topology Poisoning Attacks.

3) If there is a topology problem, I need to take a action to fixed it, for example, delete the fake link.

When looking for RESTCONF services on "localhost:8181/apidoc/explorer/index.html" I can't see the DELETE method for operational (
/operational/network-topology:network-topology/topology/{topology-id}/link/{link-id}) only GET.

On the other hand, the path /config/network-topology:network-topology/topology/{topology-id}/link/{link-id} exist.

So, I thought that It was possible to change the topology created by MININET in the path /restconf/operational/* using the path /restconf/config/*  

I am lost now !!!

Could I to use "ReadWriteTransaction rwt = dataBroker.newReadWriteTransaction" and the Link class of "network.topology.rev131021" to programmatically to change links of topology ?

What can I do to get a solution to my question ?

Thanks !!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Em quinta-feira, 23 de julho de 2020 15:21:25 BRT, Luis Gomez <ecelgp@...> escreveu:


Just want to clarify that OFP project only provides operational topology:  /restconf/operational/network-topology:network-topology/topology/flow:1 that BTW cannot be modified by user because this is discovered using LLDP packets as described in the docs. I am not sure what is the purpose of reading/writting in the config topology: /restconf/configuration/network-topology:network-topology/topology/flow:1, but whatever it is, it is not implemented in ODL.

BR/Luis


On Jul 23, 2020, at 10:27 AM, Tejas Nevrekar <tejas.nevrekar@...> wrote:

Hi Carlos,

Note that the topology is always discovered from mininet and hence will always be in /restconf/operational. More details on how this works is https://docs.opendaylight.org/projects/openflowplugin/en/latest/users/operation.html

Quick answer is there is no easy way by which you can update what's in /restconf/operational by writing to /restconf/config/....

However, you can write to the /restconf/config/network-topology:network-topology/topology/flow:1 by constructing the full payload containing nodes/links. A simple way to do that is to do a GET  /restconf/operational/network-topology:network-topology/topology/flow:1 and provide the output of that in a PUT to  /restconf/config/network-topology:network-topology/topology/flow:1.

Please let us know if this helped.

Regards,

-Tejas.
 

On Thu, Jul 23, 2020 at 10:42 AM Carlos Martins via lists.opendaylight.org<carlosmartinsufu=yahoo.com.br@...> wrote:
Hello everyone!!!

I need your help about MDSAL. 

I am creating a college project with ODL(Oxygen - karaf 0.8.0) + MININET (2.2.1) and I have installed the features:

1) odl-restconf-all, odl-dluxapps-topology, odl-l2switch-switch-ui,  and odl-netconf-connector-all

2) running the mininet like mn --topo linear,3 --controller=remote,ip=<MY_IP>,port=6633 --switch ovs

However, I am unable to get the config data store to put or delete links of the topology.

For example:

The link 

1) GET  http://localhost:8181/restconf/operational/network-topology:network-topology -> Works, return all topology
2) GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Works, return my link openflow:2:3 

But 

3) GET http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3  - > Does not work, return error 

error-message": "Request could not be completed because the relevant data model content does not exist "

and 

4) DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Does not work, return error
 
 "error-message": "Data does not exist for path: /(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology/topology/topology[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology-id=flow:1}]/link/link[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)link-id=openflow:2:3}]"
 
 
OBS: 
 
1) My topology is created by MININET and odl-l2switch-switch-ui inside DLUX UI;
2) Anyone link in the config path in RESTCONF does not work ( http://localhost:8181/restconf/config/*);
3) I am using curl commands like;

curl -H "Content-Type: application/xml" -u admin:admin -X DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3
 
So, how can I change my topology using RESTCONF commands?

Thanks !!!


----------------------------------------------- 
Carlos Martins

carlosmartinsufu@...  

-----------------------------------------------



Carlos Martins <carlosmartinsufu@...>
 

Hi Tejas Nevrekar,

Thanks for the answers!!!


Did you get to try what i suggested below?
A: Yes, I did.


However, I got 2  different topologies (attachment) when calling path to operational and config. In this case, this does not fix my question because I need that topology to be unique in both cases and the contoller must have only a single view about the topology.

When looking for "link" within attachment files we can see different links in the 2 cases

So, the change (DELETE) must be in the same topology created by MININET.

Thanks!!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Em sábado, 25 de julho de 2020 01:49:14 BRT, Tejas Nevrekar <tejas.nevrekar@...> escreveu:


Hi Carlos,

Did you get to try what i suggested below?

Regards,
Tejas

On Sat, Jul 25, 2020 at 10:16 AM Carlos Martins <carlosmartinsufu@...> wrote:
Hi All,

Basically, I need of modify the topology like described below:

1) I have an ODL module that listens to all LLDP packets. So, each LLDP packet is stored within the database in the form of (ip_controller,src_mac,src_port,dst_mac,dst_port);

2) I have an second module that reads this information and does an analysis of time to time to find Topology Poisoning Attacks.

3) If there is a topology problem, I need to take a action to fixed it, for example, delete the fake link.

When looking for RESTCONF services on "localhost:8181/apidoc/explorer/index.html" I can't see the DELETE method for operational (
/operational/network-topology:network-topology/topology/{topology-id}/link/{link-id}) only GET.

On the other hand, the path /config/network-topology:network-topology/topology/{topology-id}/link/{link-id} exist.

So, I thought that It was possible to change the topology created by MININET in the path /restconf/operational/* using the path /restconf/config/*  

I am lost now !!!

Could I to use "ReadWriteTransaction rwt = dataBroker.newReadWriteTransaction" and the Link class of "network.topology.rev131021" to programmatically to change links of topology ?

What can I do to get a solution to my question ?

Thanks !!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Em quinta-feira, 23 de julho de 2020 15:21:25 BRT, Luis Gomez <ecelgp@...> escreveu:


Just want to clarify that OFP project only provides operational topology:  /restconf/operational/network-topology:network-topology/topology/flow:1 that BTW cannot be modified by user because this is discovered using LLDP packets as described in the docs. I am not sure what is the purpose of reading/writting in the config topology: /restconf/configuration/network-topology:network-topology/topology/flow:1, but whatever it is, it is not implemented in ODL.

BR/Luis


On Jul 23, 2020, at 10:27 AM, Tejas Nevrekar <tejas.nevrekar@...> wrote:

Hi Carlos,

Note that the topology is always discovered from mininet and hence will always be in /restconf/operational. More details on how this works is https://docs.opendaylight.org/projects/openflowplugin/en/latest/users/operation.html

Quick answer is there is no easy way by which you can update what's in /restconf/operational by writing to /restconf/config/....

However, you can write to the /restconf/config/network-topology:network-topology/topology/flow:1 by constructing the full payload containing nodes/links. A simple way to do that is to do a GET  /restconf/operational/network-topology:network-topology/topology/flow:1 and provide the output of that in a PUT to  /restconf/config/network-topology:network-topology/topology/flow:1.

Please let us know if this helped.

Regards,

-Tejas.
 

On Thu, Jul 23, 2020 at 10:42 AM Carlos Martins via lists.opendaylight.org<carlosmartinsufu=yahoo.com.br@...> wrote:
Hello everyone!!!

I need your help about MDSAL. 

I am creating a college project with ODL(Oxygen - karaf 0.8.0) + MININET (2.2.1) and I have installed the features:

1) odl-restconf-all, odl-dluxapps-topology, odl-l2switch-switch-ui,  and odl-netconf-connector-all

2) running the mininet like mn --topo linear,3 --controller=remote,ip=<MY_IP>,port=6633 --switch ovs

However, I am unable to get the config data store to put or delete links of the topology.

For example:

The link 

1) GET  http://localhost:8181/restconf/operational/network-topology:network-topology -> Works, return all topology
2) GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Works, return my link openflow:2:3 

But 

3) GET http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3  - > Does not work, return error 

error-message": "Request could not be completed because the relevant data model content does not exist "

and 

4) DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Does not work, return error
 
 "error-message": "Data does not exist for path: /(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology/topology/topology[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology-id=flow:1}]/link/link[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)link-id=openflow:2:3}]"
 
 
OBS: 
 
1) My topology is created by MININET and odl-l2switch-switch-ui inside DLUX UI;
2) Anyone link in the config path in RESTCONF does not work ( http://localhost:8181/restconf/config/*);
3) I am using curl commands like;

curl -H "Content-Type: application/xml" -u admin:admin -X DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3
 
So, how can I change my topology using RESTCONF commands?

Thanks !!!


----------------------------------------------- 
Carlos Martins

carlosmartinsufu@...  

-----------------------------------------------



Tejas Nevrekar
 

Hmm I think what you are trying to do needs a bit more work. This needs a mdsal application that does the following:

1. Register data change listeners, one on config/topology/provtopo and another on operational/toplogy/flow:1. 
2. On a create/update/delete from config/topology/provtopo, reflect the same onto the operational/topology/provtopo. 
3  Likewise on a create/update/delete from operational/topology/flow:1, reflect the same onto the operational/topology/provtopo.
4. Always the final merged topology between config/provtopo and oper/flow:1 to be written to oper/provtopo.

This way you can now delete the link and it will appear removed from oper. And if the link goes down from network it will go away as well from the oper. Here note that you will need to write to config/provtopo and read from config/provtopo.

Let me know if you have any questions.

On Sat, Jul 25, 2020, 11:25 AM Carlos Martins <carlosmartinsufu@...> wrote:
Hi Tejas Nevrekar,

Thanks for the answers!!!


Did you get to try what i suggested below?
A: Yes, I did.


However, I got 2  different topologies (attachment) when calling path to operational and config. In this case, this does not fix my question because I need that topology to be unique in both cases and the contoller must have only a single view about the topology.

When looking for "link" within attachment files we can see different links in the 2 cases

So, the change (DELETE) must be in the same topology created by MININET.

Thanks!!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Em sábado, 25 de julho de 2020 01:49:14 BRT, Tejas Nevrekar <tejas.nevrekar@...> escreveu:


Hi Carlos,

Did you get to try what i suggested below?

Regards,
Tejas

On Sat, Jul 25, 2020 at 10:16 AM Carlos Martins <carlosmartinsufu@...> wrote:
Hi All,

Basically, I need of modify the topology like described below:

1) I have an ODL module that listens to all LLDP packets. So, each LLDP packet is stored within the database in the form of (ip_controller,src_mac,src_port,dst_mac,dst_port);

2) I have an second module that reads this information and does an analysis of time to time to find Topology Poisoning Attacks.

3) If there is a topology problem, I need to take a action to fixed it, for example, delete the fake link.

When looking for RESTCONF services on "localhost:8181/apidoc/explorer/index.html" I can't see the DELETE method for operational (
/operational/network-topology:network-topology/topology/{topology-id}/link/{link-id}) only GET.

On the other hand, the path /config/network-topology:network-topology/topology/{topology-id}/link/{link-id} exist.

So, I thought that It was possible to change the topology created by MININET in the path /restconf/operational/* using the path /restconf/config/*  

I am lost now !!!

Could I to use "ReadWriteTransaction rwt = dataBroker.newReadWriteTransaction" and the Link class of "network.topology.rev131021" to programmatically to change links of topology ?

What can I do to get a solution to my question ?

Thanks !!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Em quinta-feira, 23 de julho de 2020 15:21:25 BRT, Luis Gomez <ecelgp@...> escreveu:


Just want to clarify that OFP project only provides operational topology:  /restconf/operational/network-topology:network-topology/topology/flow:1 that BTW cannot be modified by user because this is discovered using LLDP packets as described in the docs. I am not sure what is the purpose of reading/writting in the config topology: /restconf/configuration/network-topology:network-topology/topology/flow:1, but whatever it is, it is not implemented in ODL.

BR/Luis


On Jul 23, 2020, at 10:27 AM, Tejas Nevrekar <tejas.nevrekar@...> wrote:

Hi Carlos,

Note that the topology is always discovered from mininet and hence will always be in /restconf/operational. More details on how this works is https://docs.opendaylight.org/projects/openflowplugin/en/latest/users/operation.html

Quick answer is there is no easy way by which you can update what's in /restconf/operational by writing to /restconf/config/....

However, you can write to the /restconf/config/network-topology:network-topology/topology/flow:1 by constructing the full payload containing nodes/links. A simple way to do that is to do a GET  /restconf/operational/network-topology:network-topology/topology/flow:1 and provide the output of that in a PUT to  /restconf/config/network-topology:network-topology/topology/flow:1.

Please let us know if this helped.

Regards,

-Tejas.
 

On Thu, Jul 23, 2020 at 10:42 AM Carlos Martins via lists.opendaylight.org<carlosmartinsufu=yahoo.com.br@...> wrote:
Hello everyone!!!

I need your help about MDSAL. 

I am creating a college project with ODL(Oxygen - karaf 0.8.0) + MININET (2.2.1) and I have installed the features:

1) odl-restconf-all, odl-dluxapps-topology, odl-l2switch-switch-ui,  and odl-netconf-connector-all

2) running the mininet like mn --topo linear,3 --controller=remote,ip=<MY_IP>,port=6633 --switch ovs

However, I am unable to get the config data store to put or delete links of the topology.

For example:

The link 

1) GET  http://localhost:8181/restconf/operational/network-topology:network-topology -> Works, return all topology
2) GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Works, return my link openflow:2:3 

But 

3) GET http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3  - > Does not work, return error 

error-message": "Request could not be completed because the relevant data model content does not exist "

and 

4) DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Does not work, return error
 
 "error-message": "Data does not exist for path: /(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology/topology/topology[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology-id=flow:1}]/link/link[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)link-id=openflow:2:3}]"
 
 
OBS: 
 
1) My topology is created by MININET and odl-l2switch-switch-ui inside DLUX UI;
2) Anyone link in the config path in RESTCONF does not work ( http://localhost:8181/restconf/config/*);
3) I am using curl commands like;

curl -H "Content-Type: application/xml" -u admin:admin -X DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3
 
So, how can I change my topology using RESTCONF commands?

Thanks !!!


----------------------------------------------- 
Carlos Martins

carlosmartinsufu@...  

-----------------------------------------------



Carlos Martins <carlosmartinsufu@...>
 

Hi Tejas Nevrekar,

tks by support.

After of long time finding in the google and forum, finaly I found the solution to my question. Follow:

1) I created an module within MDSAL Opendaylight
2) I created my listener that implements of PacketProcessingListener with an DataBroker object
3) After to indentify what packet was wrong, I sent it to "deleteLink" method to execution my bussines logic, using ReadWriteTransaction object.


My deleteLink method is:

    //Ex: topologyId=flow:1 and linkid=openflow:1:1
    public void deleteLink(String topologyId,String linkid) {
        try {
            logger.info("Topology ID:" + topologyId + " - Link ID: " + linkid);
            ReadWriteTransaction newReadWriteTransaction = dataBroker.newReadWriteTransaction();
            TopologyId tid = new TopologyId(topologyId);
            TopologyKey key = new TopologyKey(tid);
            LinkId lid = new LinkId(linkid);
            LinkKey lkey = new LinkKey(lid);
            InstanceIdentifier<Link> link = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, key).child(Link.class,lkey);
            newReadWriteTransaction.delete(LogicalDatastoreType.OPERATIONAL, link);
            try {
                newReadWriteTransaction.submit().checkedGet();
                logger.info("submit done to delete");
                
            } catch (TransactionCommitFailedException e) {
                logger.info("Commit failed.",e);
            }
            logger.info("Link " + linkid + " deleted of topology.");
        } catch (Exception e) {
            e.printStackTrace();
            logger.info("Error: " + e.getMessage());
        }
    }

    
    
This solution was enough to solve my problem !!

Thanks !!!



-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Em sábado, 25 de julho de 2020 06:54:41 BRT, Tejas Nevrekar <tejas.nevrekar@...> escreveu:


Hmm I think what you are trying to do needs a bit more work. This needs a mdsal application that does the following:

1. Register data change listeners, one on config/topology/provtopo and another on operational/toplogy/flow:1. 
2. On a create/update/delete from config/topology/provtopo, reflect the same onto the operational/topology/provtopo. 
3  Likewise on a create/update/delete from operational/topology/flow:1, reflect the same onto the operational/topology/provtopo.
4. Always the final merged topology between config/provtopo and oper/flow:1 to be written to oper/provtopo.

This way you can now delete the link and it will appear removed from oper. And if the link goes down from network it will go away as well from the oper. Here note that you will need to write to config/provtopo and read from config/provtopo.

Let me know if you have any questions.

On Sat, Jul 25, 2020, 11:25 AM Carlos Martins <carlosmartinsufu@...> wrote:
Hi Tejas Nevrekar,

Thanks for the answers!!!


Did you get to try what i suggested below?
A: Yes, I did.


However, I got 2  different topologies (attachment) when calling path to operational and config. In this case, this does not fix my question because I need that topology to be unique in both cases and the contoller must have only a single view about the topology.

When looking for "link" within attachment files we can see different links in the 2 cases

So, the change (DELETE) must be in the same topology created by MININET.

Thanks!!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Em sábado, 25 de julho de 2020 01:49:14 BRT, Tejas Nevrekar <tejas.nevrekar@...> escreveu:


Hi Carlos,

Did you get to try what i suggested below?

Regards,
Tejas

On Sat, Jul 25, 2020 at 10:16 AM Carlos Martins <carlosmartinsufu@...> wrote:
Hi All,

Basically, I need of modify the topology like described below:

1) I have an ODL module that listens to all LLDP packets. So, each LLDP packet is stored within the database in the form of (ip_controller,src_mac,src_port,dst_mac,dst_port);

2) I have an second module that reads this information and does an analysis of time to time to find Topology Poisoning Attacks.

3) If there is a topology problem, I need to take a action to fixed it, for example, delete the fake link.

When looking for RESTCONF services on "localhost:8181/apidoc/explorer/index.html" I can't see the DELETE method for operational (
/operational/network-topology:network-topology/topology/{topology-id}/link/{link-id}) only GET.

On the other hand, the path /config/network-topology:network-topology/topology/{topology-id}/link/{link-id} exist.

So, I thought that It was possible to change the topology created by MININET in the path /restconf/operational/* using the path /restconf/config/*  

I am lost now !!!

Could I to use "ReadWriteTransaction rwt = dataBroker.newReadWriteTransaction" and the Link class of "network.topology.rev131021" to programmatically to change links of topology ?

What can I do to get a solution to my question ?

Thanks !!


-----------------------------------------------
Carlos Martins

carlosmartinsufu@... 

-----------------------------------------------


Em quinta-feira, 23 de julho de 2020 15:21:25 BRT, Luis Gomez <ecelgp@...> escreveu:


Just want to clarify that OFP project only provides operational topology:  /restconf/operational/network-topology:network-topology/topology/flow:1 that BTW cannot be modified by user because this is discovered using LLDP packets as described in the docs. I am not sure what is the purpose of reading/writting in the config topology: /restconf/configuration/network-topology:network-topology/topology/flow:1, but whatever it is, it is not implemented in ODL.

BR/Luis


On Jul 23, 2020, at 10:27 AM, Tejas Nevrekar <tejas.nevrekar@...> wrote:

Hi Carlos,

Note that the topology is always discovered from mininet and hence will always be in /restconf/operational. More details on how this works is https://docs.opendaylight.org/projects/openflowplugin/en/latest/users/operation.html

Quick answer is there is no easy way by which you can update what's in /restconf/operational by writing to /restconf/config/....

However, you can write to the /restconf/config/network-topology:network-topology/topology/flow:1 by constructing the full payload containing nodes/links. A simple way to do that is to do a GET  /restconf/operational/network-topology:network-topology/topology/flow:1 and provide the output of that in a PUT to  /restconf/config/network-topology:network-topology/topology/flow:1.

Please let us know if this helped.

Regards,

-Tejas.
 

On Thu, Jul 23, 2020 at 10:42 AM Carlos Martins via lists.opendaylight.org<carlosmartinsufu=yahoo.com.br@...> wrote:
Hello everyone!!!

I need your help about MDSAL. 

I am creating a college project with ODL(Oxygen - karaf 0.8.0) + MININET (2.2.1) and I have installed the features:

1) odl-restconf-all, odl-dluxapps-topology, odl-l2switch-switch-ui,  and odl-netconf-connector-all

2) running the mininet like mn --topo linear,3 --controller=remote,ip=<MY_IP>,port=6633 --switch ovs

However, I am unable to get the config data store to put or delete links of the topology.

For example:

The link 

1) GET  http://localhost:8181/restconf/operational/network-topology:network-topology -> Works, return all topology
2) GET http://localhost:8181/restconf/operational/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Works, return my link openflow:2:3 

But 

3) GET http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3  - > Does not work, return error 

error-message": "Request could not be completed because the relevant data model content does not exist "

and 

4) DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3 ->  Does not work, return error
 
 "error-message": "Data does not exist for path: /(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)network-topology/topology/topology[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)topology-id=flow:1}]/link/link[{(urn:TBD:params:xml:ns:yang:network-topology?revision=2013-10-21)link-id=openflow:2:3}]"
 
 
OBS: 
 
1) My topology is created by MININET and odl-l2switch-switch-ui inside DLUX UI;
2) Anyone link in the config path in RESTCONF does not work ( http://localhost:8181/restconf/config/*);
3) I am using curl commands like;

curl -H "Content-Type: application/xml" -u admin:admin -X DELETE http://localhost:8181/restconf/config/network-topology:network-topology/topology/flow:1/link/openflow:2:3
 
So, how can I change my topology using RESTCONF commands?

Thanks !!!


----------------------------------------------- 
Carlos Martins

carlosmartinsufu@...  

-----------------------------------------------



abercrombiepayments@...
 

Hi Carlos,

I am trying to do the exact same thing and would really appreciate your help. Would you mind sending your full code to me so that I can delete flows from the flow table? By all means I will include your name in my work if you like.
 
I would really appreciate it if you could help me with this.

Thanks.