Using TTP (router profile) with RYU Controller
A Table Type Pattern (TTP) is an Open Network Foundation (ONF) effort to more easily enable an OpenFlow controller and switch to agree on a set of functionalities during configuration. A TTP describes specific forwarding behaviors that an OpenFlow controller can program using the OpenFlow-Switch protocol.
With respect to the Pica8 PICOS network operating system and white box switches, TTPs help overcome the limitations of Ternary Content Addressable Memory (TCAM) devices. TCAMs are power hungry, expensive memory devices that bloat the cost of solutions and cannot scale well. TTPs enable OpenFlow access to other ASIC tables, such as the VLAN, MAC, and IP along with TCAM tables. As the NOS opens up the different tables in the ASIC, an OpenFlow application is able to control the population of these tables directly in a normalized way. What this means is that the TTP is persistent across ASIC architectures. As a result, the SDN application can scale across ASIC architectures without any modification. For example, a fixed pipeline for IP routing, policy routing or an MPLS flow could be made consistent across any ASIC implementation.
This document details how to use TTP with the RYU OpenFlow Controller.
RYU Controller Configuration
RYU controller comes with sample applications that enable user to jumpstart SDN deployment. These sample applications are stored in the following directory:
Among all the applications, "ofctl_rest.py" (highlighted above) enables openflow REST interface for an open flow capable switch. This program supports OpenFlow versions 1.0 through 1.5. This provides a good framework to develop the APIs for configuring open flow rules.
pica8@ubuntu:~$ pip install ryu pica8@ubuntu:~$ cd ryu pica8@ubuntu:~/ryu$ ryu-manager ryu.app.ofctl_rest --verbose loading app ryu.app.ofctl_rest loading app ryu.controller.ofp_handler instantiating app None of DPSet creating context dpset creating context wsgi instantiating app ryu.app.ofctl_rest of RestStatsApi instantiating app ryu.controller.ofp_handler of OFPHandler (24694) wsgi starting up on http://0.0.0.0:8080 connected socket:<eventlet.greenio.base.GreenSocket object at 0x7fc8a6756950> address:('172.16.0.112', 39589) hello ev <ryu.controller.ofp_event.EventOFPHello object at 0x7fc8a6623350> move onto config mode EVENT ofp_event->dpset EventOFPSwitchFeatures switch features ev version=0x5,msg_type=0x6,msg_len=0x20,xid=0xb0590b8d,OFPSwitchFeatures(auxiliary_id=0,capabilities=15,datapath_id=6790866252693771931,n_buffers=256,n_tables=254) move onto main mode EVENT ofp_event->dpset EventOFPStateChange DPSET: register datapath <ryu.controller.controller.Datapath object at 0x7fc8a668ca10>
Another important tool required to work with APIs is one of the following:
- POSTman : (https://www.getpostman.com)
- Swagger : (http://swagger.io/swagger-ui/)
The following example will demonstrate the use of POSTman to configure the open flow rules. Typically, these tools are used with a single switch to determine the REST APIs required to configure the switch. POSTman has a facility to run the set of APIs in an iterative process to perform the task multiple times if required.
The following is the configuration on the switch required to configure TTP:
admin@PicOS-OVS$ovs-vsctl show-running-config Open_vSwitch ab7af11d-fc7a-4e9c-8165-36e67f92d043 Bridge "br0" Controller fb5f8fd6-aca8-49f9-add0-800cd6c4d840 is_connected: true role: other status: {current_version="OpenFlow14", sec_since_connect="691372", state=ACTIVE} target: "tcp:172.16.0.123:6633" datapath_id: "5e3e00e09500169a" datapath_type: "pica8" Port "te-1/1/1" Interface "te-1/1/1" type: "pica8" tag: 1 vlan_mode: trunk Port "br0" Interface "br0" mtu: 1500 type: internal Port "te-1/1/2" Interface "te-1/1/2" type: "pica8" tag: 1 vlan_mode: trunk protocols: ["OpenFlow14"] Pica8 6d736702-1adb-44f8-93e6-998166ca813f hardware_type: "5401" pica_ttp_enable: true pica_ttp_name: RouterTTP.json
Step 1:Â Setting the following environment variables in Postman helps in managing the variables
Table Type Patterns (TTP) are described in detail in the following blog (http://www.pica8.com/pica8-deep-dive/scaling-up-sdns-using-ttps-table-type-patterns/). The following is based on steps mentioned in the blog.
Step 2 :Â Creating a mac entry in the L2 table
Verify the switch has the flow configured
admin@PicOS-OVS$ovs-ofctl dump-flows br0 OFPST_FLOW reply (OF1.4) (xid=0x2): flow_id=3735291, cookie=0x0, duration=690201.683s, table=20, n_packets=n/a, n_bytes=n/a, dl_vlan=200,dl_dst=00:11:11:11:11:11 actions=goto_table:30
Step 3 :Â Creating a group entry (group_id = 1) for the egress L2 interface
Verify the group exists on the switch
admin@PicOS-OVS$ovs-ofctl dump-groups br0 OFPST_GROUP_DESC reply (OF1.4) (xid=0x2): group_id=1,type=indirect,bucket=weight:0,actions=output:97
Step 4 :Â Create a group entry (group_id = 2) for the egress L3 interface
Verify the switch has the configuration
admin@PicOS-OVS$ovs-ofctl dump-groups br0 OFPST_GROUP_DESC reply (OF1.4) (xid=0x2): group_id=1,type=indirect,bucket=weight:0,actions=output:97 group_id=2,type=indirect,bucket=weight:0,actions=set_field:00:01:01:01:01:01->eth_src,set_field:00:02:02:02:01:01->eth_dst,set_field:2016->vlan_vid,group:1
Step 5 :Â Create a IP flow in the L3 tableÂ
Verify the configuration on the switch
admin@PicOS-OVS$ovs-ofctl dump-flows br0 OFPST_FLOW reply (OF1.4) (xid=0x2): flow_id=3735291, cookie=0x0, duration=690201.683s, table=20, n_packets=n/a, n_bytes=n/a, dl_vlan=200,dl_dst=00:11:11:11:11:11 actions=goto_table:30 flow_id=3735292, cookie=0x0, duration=690201.538s, table=30, n_packets=n/a, n_bytes=n/a, ip,nw_dst=10.0.1.0/24 actions=write_actions(group:2,dec_ttl),goto_table:60
"ovs-ofctl dump-flows br0" shows the software flow table configured by the controller. "ovs-appctl pica/dump-flows" shows the ASIC tables.
admin@PicOS-OVS$ovs-appctl pica/dump-flows Ingress Port Table: (Total 0 flows) VLAN Table: (Total 0 flows) Termination MAC Table: (Total 1 flows) ID=5 dl_vlan=200,dl_dst=00:11:11:11:11:11, actions:goto(Unicast Routing Table) Unicast Routing Table: (Total 1 flows) ID=6 ip,nw_dst=10.0.1.0/24, actions:group(id=2,indirect,n=1,b0(set(dl_src=00:01:01:01:01:01,dl_dst=00:02:02:02:01:01),set(vlan_vid=2016),group(id=1,indirect,n=1,b0(output:97)))),goto(Policy ACL Table) Policy ACL Table: (Total 1 flows) ID=1 priority=18000009,tcp,dl_dst=00:e0:95:00:16:9a,nw_src=172.16.0.123,tp_src=6633, actions:set(queue=7),output:60000
Copyright © 2024 Pica8 Inc. All Rights Reserved.