Initial commit of nfchain.
[affinity.git] / nfchain / api / src / main / yang / nfchain.yang
1 module nfchain { 
2     namespace "urn:opendaylight:affinity:nfchain";
3     prefix nfchain;
4
5     import ietf-inet-types { prefix inet; }
6     import ietf-yang-types { prefix yang; }
7     import yang-ext { prefix ext; }
8     import opendaylight-inventory {prefix inv;}
9     import opendaylight-l2-types { prefix l2types; }
10
11     revision "2013-10-20" {
12         description "Initial revision of affinity model to be reviewed";
13     }
14
15    //**************************************************
16     // Gateway hosting the network function. 
17     //**************************************************
18     grouping gateway {
19         leaf id {
20             type string;
21         }
22         // Address is either an IP address, MAC address, or switch/port. 
23         leaf location {
24             description "Mac or Inet address";
25             type union {
26                 type inv:node-connector-id;
27                 type inet:ip-address;
28             }
29         }
30     }
31
32     // Each nf chain has an id, a flowspec and a list of gateways. 
33     grouping chain {
34         leaf id {
35             type chain-id;
36         }   
37         leaf flowSpec {
38             type uint32; // tbd
39         }
40         list gateway {
41             key id;
42             ext:context-instance "gateway-context";
43             uses gateway;
44         }
45     }   
46
47     // Container for all nf_chain objects
48     container nfdb {
49         list chain {
50             key id;
51             ext:context-instance "chain";
52             uses chain;
53         }
54     }
55
56     typedef chain-id {
57         type inet:uri;
58     }
59
60     typedef gateway-ref {
61         type instance-identifier;
62     }
63
64     identity gateway-context;
65
66     // nf chain reference.
67     typedef chain-ref {
68         type instance-identifier;
69     }
70     identity chain-context;
71
72     //**************************************************
73     // Gateway chain. 
74     //**************************************************
75     rpc add {
76         input {
77               leaf chain {
78                   type chain-id;
79               }
80               container gateway {
81                   uses gateway;
82               }
83         }
84     }
85     rpc list {
86     }
87 }