128c78f9971a5e5eb567b2adca78661924d43aed
[groupbasedpolicy.git] / ui-backend / src / main / yang / ui-backend.yang
1 module ui-backend {\r
2     namespace "urn:opendaylight:params:xml:ns:yang:controller:config:ui-backend";\r
3     prefix "ui-backend";\r
4 \r
5     import policy {prefix gbp-policy;}\r
6     import gbp-common {prefix gbp-common;}\r
7     import endpoint {prefix endpoint;}\r
8 \r
9     description\r
10         "Module contains RPC definitions for more easier interaction of the GUI with the GBP APIs.";\r
11 \r
12     revision "2015-05-11" {\r
13         description "Initial revision of ui-backend model";\r
14     }\r
15 \r
16     grouping endpoint-group-identifier-fields {\r
17         leaf tenant-id {\r
18             type gbp-common:tenant-id;\r
19         }\r
20         leaf endpoint-group-id {\r
21             type gbp-common:endpoint-group-id;\r
22         }\r
23     }\r
24 \r
25     grouping consumer-endpoint-group-ref {\r
26         leaf consumer-tenant-id {\r
27             type leafref {\r
28                 path "/gbp-policy:tenants/gbp-policy:tenant/gbp-policy:id";\r
29             }\r
30         }\r
31         leaf consumer-endpoint-group-id {\r
32             type leafref {\r
33                 path "/gbp-policy:tenants/gbp-policy:tenant/gbp-policy:policy/gbp-policy:endpoint-group/gbp-policy:id";\r
34             }\r
35         }\r
36     }\r
37 \r
38     grouping provider-endpoint-group-ref {\r
39         leaf provider-tenant-id {\r
40             type leafref {\r
41                 path "/gbp-policy:tenants/gbp-policy:tenant/gbp-policy:id";\r
42             }\r
43         }\r
44         leaf provider-endpoint-group-id {\r
45             type leafref {\r
46                 path "/gbp-policy:tenants/gbp-policy:tenant/gbp-policy:policy/gbp-policy:endpoint-group/gbp-policy:id";\r
47             }\r
48         }\r
49     }\r
50 \r
51     rpc get-endpoints-from-endpoint-group {\r
52         description "Returns endpoints which are in the given endpoint group.";\r
53         input {\r
54             uses endpoint-group-identifier-fields;\r
55         }\r
56         output {\r
57             list ui-endpoint {\r
58                 description\r
59                     "Endpoints indexed by layer 2 addreses.";\r
60                 key "l2-context mac-address";\r
61                 uses endpoint:endpoint-fields;\r
62             }\r
63         }\r
64     }\r
65 \r
66     rpc get-subjects-between-endpoint-groups {\r
67         description "Returns subjects between endpoint group pairs where endpoint groups are from the given tenant.";\r
68         input {\r
69             leaf tenant-id {\r
70                 description "Tenant ID of the tenant.";\r
71                 type gbp-common:tenant-id;\r
72                 mandatory true;\r
73             }\r
74             container from-oper-data {\r
75                 presence "Resolve subjects for endpoint gorup pairs based on operational data.";\r
76             }\r
77         }\r
78         output {\r
79             list endpoint-group-pair-with-subject {\r
80                 key "consumer-endpoint-group-id consumer-tenant-id provider-endpoint-group-id provider-tenant-id";\r
81                 uses consumer-endpoint-group-ref;\r
82                 uses provider-endpoint-group-ref;\r
83                 list ui-subject {\r
84                     key "name";\r
85                     leaf name {\r
86                         description "A name for the subject";\r
87                         type gbp-common:subject-name;\r
88                     }\r
89                     list ui-rule {\r
90                         key "name";\r
91                         leaf name {\r
92                             description "A name for the rule";\r
93                             type gbp-common:rule-name;\r
94                         }\r
95                         uses gbp-policy:has-classifier-refs;\r
96                         uses gbp-policy:has-action-refs;\r
97                         uses gbp-policy:has-order;\r
98                     }\r
99                     uses gbp-policy:has-order;\r
100                 }\r
101             }\r
102         }\r
103     }\r
104 \r
105 }\r