1 TTP Model Developer Guide
2 =========================
7 Table Type Patterns are a specification developed by the `Open
8 Networking Foundation <https://www.opennetworking.org/>`__ to enable the
9 description and negotiation of subsets of the OpenFlow protocol. This is
10 particularly useful for hardware switches that support OpenFlow as it
11 enables the to describe what features they do (and thus also what
12 features they do not) support. More details can be found in the full
13 specification listed on the `OpenFlow specifications
14 page <https://www.opennetworking.org/sdn-resources/onf-specifications/openflow>`__.
16 TTP Model Architecture
17 ----------------------
19 The TTP Model provides a YANG-modeled type for a TTP and allows them to
20 be associated with a master list of known TTPs, as well as active and
21 supported TTPs with nodes in the MD-SAL inventory model.
23 Key APIs and Interfaces
24 -----------------------
26 The key API provided by the TTP Model feature is the ability to store a
27 set of TTPs in the MD-SAL as well as associate zero or one active TTPs
28 and zero or more supported TTPs along with a given node in the MD-SAL
31 API Reference Documentation
32 ---------------------------
37 See the generated RESTCONF API documentation at:
38 http://localhost:8181/apidoc/explorer/index.html
40 Look for the onf-ttp module to expand and see the various RESTCONF APIs.
45 As stated above there are 3 locations where a Table Type Pattern can be
46 placed into the MD-SAL Data Store. They correspond to 3 different REST
49 1. ``restconf/config/onf-ttp:opendaylight-ttps/onf-ttp:table-type-patterns/``
51 2. ``restconf/config/opendaylight-inventory:nodes/node/{id}/ttp-inventory-node:active_ttp/``
53 3. ``restconf/config/opendaylight-inventory:nodes/node/{id}/ttp-inventory-node:supported_ttps/``
57 Typically, these URIs are running on the machine the controller is
58 on at port 8181. If you are on the same machine they can thus be
59 accessed at ``http://localhost:8181/<uri>``
61 Using the TTP Model RESTCONF APIs
62 ---------------------------------
64 Setting REST HTTP Headers
65 ~~~~~~~~~~~~~~~~~~~~~~~~~
70 The REST API calls require authentication by default. The default method
71 is to use basic auth with a user name and password of ‘admin’.
73 Content-Type and Accept
74 ^^^^^^^^^^^^^^^^^^^^^^^
76 RESTCONF supports both xml and json. This example focuses on JSON, but
77 xml can be used just as easily. When doing a PUT or POST be sure to
78 specify the appropriate ``Conetnt-Type`` header: either
79 ``application/json`` or ``application/xml``.
81 When doing a GET be sure to specify the appropriate ``Accept`` header:
82 again, either ``application/json`` or ``application/xml``.
87 The contents of a PUT or POST should be a OpenDaylight Table Type
88 Pattern. An example of one is provided below. The example can also be
89 found at `parser/sample-TTP-from-tests.ttp in the TTP git
90 repository <https://git.opendaylight.org/gerrit/gitweb?p=ttp.git;a=blob;f=parser/sample-TTP-from-tests.ttp;h=45130949b25c6f86b750959d27d04ec2208935fb;hb=HEAD>`__.
92 **Sample Table Type Pattern (json).**
97 "table-type-patterns": {
98 "table-type-pattern": [
102 "This TTP is not published for use by ONF. It is an example and for",
103 "illustrative purposes only.",
104 "If this TTP were published for use it would include",
105 "guidance as to any security considerations in this doc member."
109 "authority": "org.opennetworking.fawg",
110 "OF_protocol_version": "1.3.3",
114 "Example of a TTP supporting L2 (unicast, multicast, flooding), L3 (unicast only),",
122 "The VLAN ID of a locally attached L2 subnet on a Router."
124 "var": "<subnet_VID>"
128 "An OpenFlow group identifier (integer) identifying a group table entry",
129 "of the type indicated by the variable name"
131 "var": "<<group_entry_types/name>>"
137 "Flow entry notification Extension – notification of changes in flow entries"
143 "Group notifications Extension – notification of changes in group or meter entries"
151 "name": "ControllerMeterType",
155 "rate": "1000..10000",
161 "name": "TrafficMeter",
164 "type": "DSCP_REMARK",
165 "rate": "10000..500000",
170 "rate": "10000..500000",
178 "name": "ControllerMeter",
180 "type": "ControllerMeterType",
189 "name": "AllArpMeter",
191 "type": "ControllerMeterType",
203 "name": "ControlFrame",
207 "name": "IngressVLAN",
211 "name": "MacLearning",
223 "name": "ProtoFilter",
240 "name": "Showing-curt-how-this-works",
247 "Filters L2 control reserved destination addresses and",
248 "may forward control packets to the controller.",
249 "Directs all other packets to the Ingress VLAN table."
251 "name": "ControlFrame",
255 "This match/action pair allows for flow_mods that match on either",
256 "ETH_TYPE or ETH_DST (or both) and send the packet to the",
257 "controller, subject to metering."
259 "name": "Frame-To-Controller",
263 "match_type": "all_or_exact"
267 "match_type": "exact"
273 "This meter may be used to limit the rate of PACKET_IN frames",
274 "sent to the controller"
276 "instruction": "METER",
277 "meter_name": "ControllerMeter"
280 "instruction": "APPLY_ACTIONS",
291 "built_in_flow_mods": [
294 "Mandatory filtering of control frames with C-VLAN Bridge reserved DA."
296 "name": "Control-Frame-Filter",
301 "mask": "0xfffffffffff0",
302 "value": "0x0180C2000000"
308 "Mandatory miss flow_mod, sends packets to IngressVLAN table."
310 "name": "Non-Control-Frame",
314 "instruction": "GOTO_TABLE",
315 "table": "IngressVLAN"
322 "group_entry_types": [
325 "Output to a port, removing VLAN tag if needed.",
326 "Entry per port, plus entry per untagged VID per port."
328 "name": "EgressPort",
329 "group_type": "INDIRECT",
332 "name": "OutputTagged",
341 "name": "OutputUntagged",
354 "name": "OutputVIDTranslate",
357 "action": "SET_FIELD",
359 "value": "<local_vid>"
373 "This object contains just a few examples of flow paths, it is not",
374 "a comprehensive list of the flow paths required for this TTP. It is",
375 "intended that the flow paths array could include either a list of",
376 "required flow paths or a list of specific flow paths that are not",
377 "required (whichever is more concise or more useful."
461 In this example we’ll do a PUT to install the sample TTP from above into
462 OpenDaylight and then retrieve it both as json and as xml. We’ll use the
464 Client <https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm>`__
465 for Chrome in the examples, but any method of accessing REST should
468 First, we’ll fill in the basic information:
470 .. figure:: ./images/ttp-screen1-basic-auth.png
471 :alt: Filling in URL, content, Content-Type and basic auth
473 Filling in URL, content, Content-Type and basic auth
476 ``http://localhost:8181/restconf/config/onf-ttp:opendaylight-ttps/onf-ttp:table-type-patterns/``
478 2. Set the action to ``PUT``
482 4. Set a header for ``Content-Type`` to ``application/json``
484 5. Make sure the content is set to raw and
486 6. Copy the sample TTP from above into the content
488 7. Click the Basic Auth tab and
490 8. Set the username and password to admin
492 9. Click Refresh headers
494 .. figure:: ./images/ttp-screen2-applied-basic-auth.png
495 :alt: Refreshing basic auth headers
497 Refreshing basic auth headers
499 After clicking Refresh headers, we can see that a new header
500 (``Authorization``) has been created and this will allow us to
501 authenticate to make the REST call.
503 .. figure:: ./images/ttp-screen3-sent-put.png
508 At this point, clicking send should result in a Status response of ``200
509 OK`` indicating we’ve successfully PUT the TTP into OpenDaylight.
511 .. figure:: ./images/ttp-screen4-get-json.png
512 :alt: Retrieving the TTP as json via a GET
514 Retrieving the TTP as json via a GET
516 We can now retrieve the TTP by:
518 1. Changing the action to ``GET``
520 2. Setting an ``Accept`` header to ``application/json`` and
524 .. figure:: ./images/ttp-screen5-get-xml.png
525 :alt: Retrieving the TTP as xml via a GET
527 Retrieving the TTP as xml via a GET
529 The same process can retrieve the content as xml by setting the
530 ``Accept`` header to ``application/xml``.