CPqD dpctl Configuration
dpctl is a command line utility from CPqD that mimics a Controller and installs flows in an OpenFlow aware switch.
Scenario A
Add VLAN Flow Table entries
- ./dpctl tcp:Switch_IP:[port] flow-mod cmd=add,table=10 in_port=1,vlan_vid=10 goto:20
- ./dpctl tcp:Switch_IP[:port] flow-mod cmd=add,table=10 in_port=2,vlan_vid=10 goto:20
- ./dpctl tcp:Switch_IP[:port] flow-mod cmd=add,table=10 in_port=5,vlan_vid=10 goto:20
The above configuration will add ports 1, 2 and 5 in VLAN 10.
Note: dpctl does not support VLAN mask. VLAN mask should be passed as 0x1fff by the Ryu Controller if configuring VLAN Id.
Create two L2 Interface Groups
Create an L2 interface group on interface 3 and VLAN 11
- ./dpctl tcp: Switch_IP[:port] group-mod cmd=add,type=ind,group=720899 weight=0,port=any, group=any output=3
Create an L2 interface group on interface 4 and VLAN 11
- ./dpctl tcp: Switch_IP[:port] group-mod cmd=add,type=ind,group=720900 weight=0,port=any, group=any output=4
Create a Termination MAC Flow table entry to route the ingress traffic
- ./dpctl tcp: Switch_IP[:port] flow-mod cmd=add,table=20,eth_type=0x800,vlan_vid=10,eth_dst=00:01:02:03:04:05/ff:ff:ff:ff:ff:ff goto:30
Create two L3 Unicast Groups with reference to the above created L2 Interface groups
- ./dpctl tcp: Switch_IP[:port] group-mod cmd=add,type=ind,group=536870913 weight=0,port=any,group=any set_field=vlan_vid:11,set_field=eth_dst:00:00:00:00:00:01/ff:ff:ff:ff:ff:ff,set_field=eth_src:00:01:02:03:04:05/ff:ff:ff:ff:ff:ff,group=720899
This creates an L3 Unicast group with group Id 0x20000001. This group defines an action which sends a tagged packet out on port 3 with VLAN 11 and the configured destination and source MAC.
- ./dpctl tcp: Switch_IP[:port] group-mod cmd=add,type=ind,group=536870914 weight=0,port=any,group=any set_field=vlan_vid:11,set_field=eth_dst:00:00:00:00:00:02/ff:ff:ff:ff:ff:ff,set_field=eth_src:00:01:02:03:04:05/ff:ff:ff:ff:ff:ff,group=720900
This creates an L3 Unicast group with group Id 0x20000002. This group defines an action which sends a tagged packet out on port 4 with VLAN 11 and the configured destination and source MAC.
Create an ECMP Group and add the above created Unicast Groups into it
- ./dpctl tcp: Switch_IP[:port] group-mod cmd=add,type=ind,group=1879048193 weight=0,port=any,group=any group=536870913 weight=0,port=any,group=any group=536870914
This creates an ECMP group with group Id 0x70000001 with two next hops in the group.
Create a Unicast Routing Flow table entry
- ./dpctl tcp: Switch_IP[:port] flow-mod cmd=add,table=30 eth_type=0x800,ip_dst=192.168.5.0/24 write:group=1879048193 goto:60
This creates a Unicast Routing Flow entry that matches IPv4 packets (ether type 0x800) with destination IP subnet 192.168.5.0 and routes the packets to the ECMP next hop group 0x70000001.
Scenario B
All the configuration of scenario A is required.
On top of it create a ACL Policy Flow table entry
- ./dpctl tcp: Switch_IP[:port] flow-mod cmd=add,table=60 in_port=1,eth_type=0x800,vlan_vid=10 ,eth_dst=00:01:02:03:04:05/ff:ff:ff:ff:ff:ff, ip_dst=192.168.5.1/32 write:group=536870913
This creates an ACL Policy Flow table entry that matches incoming traffic on the given parameters and routes it to the next hop implemented by the L3 Unicast group Id 0x20000001. This routes the packets destined to IP 192.168.5.1 out of port 3.
Ryu Configuration
- Ryu controller (RC) intended to configure OF-DPA switch by Open Flow 1.3 protocol.
- RC working in the passive mode and listen to TCP port 6633.
- To make changes in flow and group tables RC execute configuration script.
- Configuration script
ofdpa-te.py
get parameters from JSON files - for each flow/group in separate file.
- Scenario file contain list of parameter files which will be sequentially read and set.
Scenario A
cd <ofdpa-te.py directory>
Open file conf/ofdpa-te.json
Ensure that it contains:
{
"config_directory":"conf"
"#working_directory":"scenarioA.json"
"#working_directory":"scenarioB.json"
"#working_directory":"AddACL.json"
"#working_directory":"DelACL.json"
}
Remove leading hash symbol from string which contains scenarioA.json
.
Save changes and close file.
Open file conf/scenarioA.json
Ensure that it contains:
{
[
"te_add_vlan_1.json",
"te_add_vlan_2.json",
"te_add_vlan_5.json",
"te_add_group_l2_0xb003.json",
"te_add_group_l2_0xb003.json",
"te_add_termination_mac.json"
"te_add_group_l3_0x20000001_.json",
"te_add_group_l3_0x20000001.json",
"te_add_ecmp.json",
"te_add_ucast_routing.json"
]
}
Examples of JSON files are located in Appendix A
Close file.
Run OF-DPA agent:
ofagentapp --controller=<IP>:6633 [-a 0|1|2|3] &
( -a is a loglevel)
Run RC
ryu-manager ofdpa-te.py [–verbose]
To stop RC press Ctrl-C
Scenario B
The same as ScenarioA, but in conf/ofdpa-te.json
should uncomment line which contains scenarioB.json
Content of scenarioB.json
the same as scenarioA.json
except additional line at the end:
te_add_acl.json
Add ACL
Adds the ACL rule.
This allows to perform scenario B without cleaning ScenarioA configuration.
{
[
"te_add_acl.json"
]
}
Del ACL
Deletes the ACL rule.
This allows to return to scenarioB from scenarioA configuration.
{
[
"te_del_acl.json"
]
}
OpenDaylight Configuration
- OpenDaylight (ODL) controller helps in configuring the OpenFlow switch with OpenFlow 1.3.1 openflowplugin support.
- The ODL controller with OF 1.3.1 plugin listens on port 6653 for the connections from the OpenFlow switches.
- Traffic engineering scenarios mentioned at Setup description are provided by RESTCONF with the config files in json format. The config files can also be in xml format.
- The configuration scripts
scenarioA.sh
and scenarioB.sh
program the flows/groups via cURL commands that send REST requests via HTTP to the ODL Controller. The config scripts provided take the payload in json format.
Scenario A
- Start ODL controller (./run.sh)
- Run the ofagentapp application on the switch
ofagentapp --controller=<IP>:6653 [-a 0|1|2|3] &
- In the file, te_test_scripts/scenarioA.sh update the controller IP if the script is not being executed on the local machine and update the Node ID (at the controller's interface (OSGI) check by executing printNodes).
- Run ./scenarioA.sh. This installs the required flows/groups invoking the cURL commands that send HTTP requests with payload as the config files in json.
Scenario B
- scenarioB.sh is similar to scenarioA.sh but it includes an additional cURL command that adds an ACL flow with payload as te_add_acl.json file.
- In the file, te_test_scripts/scenarioB.sh update the controller IP, if the script is not being executed on the local machine and update the Node ID (at the controller's interface (OSGI) check by executing printNodes).
- Run ./scenarioB.sh.
Add ACL
Adds the ACL rule.
This allows to perform scenario B without cleaning ScenarioA configuration.
Del ACL
Deletes the ACL rule.
This allows to return to scenarioB from scenarioA configuration.