1 .. _ttp_model_dev_guide:
3 TTP Model Developer Guide
4 =========================
9 Table Type Patterns are a specification developed by the `Open
10 Networking Foundation <https://www.opennetworking.org/>`__ to enable the
11 description and negotiation of subsets of the OpenFlow protocol. This is
12 particularly useful for hardware switches that support OpenFlow as it
13 enables the to describe what features they do (and thus also what
14 features they do not) support. More details can be found in the full
15 specification listed on the `OpenFlow specifications
16 page <https://www.opennetworking.org/sdn-resources/onf-specifications/openflow>`__.
18 TTP Model Architecture
19 ----------------------
21 The TTP Model provides a YANG-modeled type for a TTP and allows them to
22 be associated with a master list of known TTPs, as well as active and
23 supported TTPs with nodes in the MD-SAL inventory model.
25 Key APIs and Interfaces
26 -----------------------
28 The key API provided by the TTP Model feature is the ability to store a
29 set of TTPs in the MD-SAL as well as associate zero or one active TTPs
30 and zero or more supported TTPs along with a given node in the MD-SAL
33 API Reference Documentation
34 ---------------------------
39 See the generated RESTCONF API documentation at:
40 http://localhost:8181/apidoc/explorer/index.html
42 Look for the onf-ttp module to expand and see the various RESTCONF APIs.
47 As stated above there are 3 locations where a Table Type Pattern can be
48 placed into the MD-SAL Data Store. They correspond to 3 different REST
51 1. ``restconf/config/onf-ttp:opendaylight-ttps/onf-ttp:table-type-patterns/``
53 2. ``restconf/config/opendaylight-inventory:nodes/node/{id}/ttp-inventory-node:active_ttp/``
55 3. ``restconf/config/opendaylight-inventory:nodes/node/{id}/ttp-inventory-node:supported_ttps/``
59 Typically, these URIs are running on the machine the controller is
60 on at port 8181. If you are on the same machine they can thus be
61 accessed at ``http://localhost:8181/<uri>``
63 Using the TTP Model RESTCONF APIs
64 ---------------------------------
66 Setting REST HTTP Headers
67 ~~~~~~~~~~~~~~~~~~~~~~~~~
72 The REST API calls require authentication by default. The default method
73 is to use basic auth with a user name and password of ‘admin’.
75 Content-Type and Accept
76 ^^^^^^^^^^^^^^^^^^^^^^^
78 RESTCONF supports both xml and json. This example focuses on JSON, but
79 xml can be used just as easily. When doing a PUT or POST be sure to
80 specify the appropriate ``Conetnt-Type`` header: either
81 ``application/json`` or ``application/xml``.
83 When doing a GET be sure to specify the appropriate ``Accept`` header:
84 again, either ``application/json`` or ``application/xml``.
89 The contents of a PUT or POST should be a OpenDaylight Table Type
90 Pattern. An example of one is provided below. The example can also be
91 found at `parser/sample-TTP-from-tests.ttp in the TTP git
92 repository <https://git.opendaylight.org/gerrit/gitweb?p=ttp.git;a=blob;f=parser/sample-TTP-from-tests.ttp;h=45130949b25c6f86b750959d27d04ec2208935fb;hb=HEAD>`__.
94 **Sample Table Type Pattern (json).**
99 "table-type-patterns": {
100 "table-type-pattern": [
104 "This TTP is not published for use by ONF. It is an example and for",
105 "illustrative purposes only.",
106 "If this TTP were published for use it would include",
107 "guidance as to any security considerations in this doc member."
111 "authority": "org.opennetworking.fawg",
112 "OF_protocol_version": "1.3.3",
116 "Example of a TTP supporting L2 (unicast, multicast, flooding), L3 (unicast only),",
124 "The VLAN ID of a locally attached L2 subnet on a Router."
126 "var": "<subnet_VID>"
130 "An OpenFlow group identifier (integer) identifying a group table entry",
131 "of the type indicated by the variable name"
133 "var": "<<group_entry_types/name>>"
139 "Flow entry notification Extension – notification of changes in flow entries"
145 "Group notifications Extension – notification of changes in group or meter entries"
153 "name": "ControllerMeterType",
157 "rate": "1000..10000",
163 "name": "TrafficMeter",
166 "type": "DSCP_REMARK",
167 "rate": "10000..500000",
172 "rate": "10000..500000",
180 "name": "ControllerMeter",
182 "type": "ControllerMeterType",
191 "name": "AllArpMeter",
193 "type": "ControllerMeterType",
205 "name": "ControlFrame",
209 "name": "IngressVLAN",
213 "name": "MacLearning",
225 "name": "ProtoFilter",
242 "name": "Showing-curt-how-this-works",
249 "Filters L2 control reserved destination addresses and",
250 "may forward control packets to the controller.",
251 "Directs all other packets to the Ingress VLAN table."
253 "name": "ControlFrame",
257 "This match/action pair allows for flow_mods that match on either",
258 "ETH_TYPE or ETH_DST (or both) and send the packet to the",
259 "controller, subject to metering."
261 "name": "Frame-To-Controller",
265 "match_type": "all_or_exact"
269 "match_type": "exact"
275 "This meter may be used to limit the rate of PACKET_IN frames",
276 "sent to the controller"
278 "instruction": "METER",
279 "meter_name": "ControllerMeter"
282 "instruction": "APPLY_ACTIONS",
293 "built_in_flow_mods": [
296 "Mandatory filtering of control frames with C-VLAN Bridge reserved DA."
298 "name": "Control-Frame-Filter",
303 "mask": "0xfffffffffff0",
304 "value": "0x0180C2000000"
310 "Mandatory miss flow_mod, sends packets to IngressVLAN table."
312 "name": "Non-Control-Frame",
316 "instruction": "GOTO_TABLE",
317 "table": "IngressVLAN"
324 "group_entry_types": [
327 "Output to a port, removing VLAN tag if needed.",
328 "Entry per port, plus entry per untagged VID per port."
330 "name": "EgressPort",
331 "group_type": "INDIRECT",
334 "name": "OutputTagged",
343 "name": "OutputUntagged",
356 "name": "OutputVIDTranslate",
359 "action": "SET_FIELD",
361 "value": "<local_vid>"
375 "This object contains just a few examples of flow paths, it is not",
376 "a comprehensive list of the flow paths required for this TTP. It is",
377 "intended that the flow paths array could include either a list of",
378 "required flow paths or a list of specific flow paths that are not",
379 "required (whichever is more concise or more useful."
463 In this example we’ll do a PUT to install the sample TTP from above into
464 OpenDaylight and then retrieve it both as json and as xml. We’ll use the
466 Client <https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm>`__
467 for Chrome in the examples, but any method of accessing REST should
470 First, we’ll fill in the basic information:
472 .. figure:: ./images/ttp-screen1-basic-auth.png
473 :alt: Filling in URL, content, Content-Type and basic auth
475 Filling in URL, content, Content-Type and basic auth
478 ``http://localhost:8181/restconf/config/onf-ttp:opendaylight-ttps/onf-ttp:table-type-patterns/``
480 2. Set the action to ``PUT``
484 4. Set a header for ``Content-Type`` to ``application/json``
486 5. Make sure the content is set to raw and
488 6. Copy the sample TTP from above into the content
490 7. Click the Basic Auth tab and
492 8. Set the username and password to admin
494 9. Click Refresh headers
496 .. figure:: ./images/ttp-screen2-applied-basic-auth.png
497 :alt: Refreshing basic auth headers
499 Refreshing basic auth headers
501 After clicking Refresh headers, we can see that a new header
502 (``Authorization``) has been created and this will allow us to
503 authenticate to make the REST call.
505 .. figure:: ./images/ttp-screen3-sent-put.png
510 At this point, clicking send should result in a Status response of ``200
511 OK`` indicating we’ve successfully PUT the TTP into OpenDaylight.
513 .. figure:: ./images/ttp-screen4-get-json.png
514 :alt: Retrieving the TTP as json via a GET
516 Retrieving the TTP as json via a GET
518 We can now retrieve the TTP by:
520 1. Changing the action to ``GET``
522 2. Setting an ``Accept`` header to ``application/json`` and
526 .. figure:: ./images/ttp-screen5-get-xml.png
527 :alt: Retrieving the TTP as xml via a GET
529 Retrieving the TTP as xml via a GET
531 The same process can retrieve the content as xml by setting the
532 ``Accept`` header to ``application/xml``.