1 # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
2 # Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # NOTE: this file is intendend to be replaced with mechanically generated
18 # file if/when OF-Config yang specification is available with a suitable
21 from ryu.lib.of_config.base import _Base, _e, _ct
24 class OFPortConfigurationType(_Base):
26 _e('admin-state', is_list=False),
27 _e('no-receive', is_list=False),
28 _e('no-forward', is_list=False),
29 _e('no-packet-in', is_list=False),
33 class OFPortStateType(_Base):
35 _e('oper-state', is_list=False),
36 _e('blocked', is_list=False),
37 _e('live', is_list=False),
41 class OFPortType(_Base):
43 _e('resource-id', is_list=False),
44 _e('number', is_list=False),
45 _e('name', is_list=False),
46 _e('current-rate', is_list=False),
47 _e('max-rate', is_list=False),
48 _ct('configuration', OFPortConfigurationType, is_list=False),
49 _ct('state', OFPortStateType, is_list=False),
50 _ct('features', None, is_list=False),
51 _ct('tunnel-type', None, is_list=False),
55 class OFQueuePropertiesType(_Base):
57 _e('min-rate', is_list=False),
58 _e('max-rate', is_list=False),
59 _e('experimenter', is_list=True),
63 class OFQueueType(_Base):
65 _e('resource-id', is_list=False),
66 _e('id', is_list=False),
67 _e('port', is_list=False),
68 _ct('properties', OFQueuePropertiesType, is_list=False),
72 class OFCapableSwitchResourcesType(_Base):
74 _ct('port', OFPortType, is_list=True),
75 _ct('queue', OFQueueType, is_list=True),
76 _ct('owned-certificate', None, is_list=True),
77 _ct('external-certificate', None, is_list=True),
78 _ct('flow-table', None, is_list=True),
82 class OFControllerStateType(_Base):
84 _e('connection-state', is_list=False),
85 _e('current-version', is_list=False),
87 # XXX OF-Config 1.1.1 is inconsistent about supported-versions.
89 # according to its xml schema (p.43), i believe this should look
90 # like the following. it's what linc/of_config does, too.
91 # <supported-versions>1.3</supported-versions>
93 # on the other hand, it has an example (p.45) like the following.
94 # this one is compatible with OF-Config 1.1.
95 # <supported-versions>
96 # <version>1.2</version>
97 # <version>1.1</version>
98 # </supported-versions>
100 _e('supported-versions', is_list=True),
101 _e('local-ip-address-in-use', is_list=False),
102 _e('local-port-in-use', is_list=False),
106 class OFControllerType(_Base):
108 _e('id', is_list=False),
109 _e('role', is_list=False),
110 _e('ip-address', is_list=False),
111 _e('port', is_list=False),
112 _e('local-ip-address', is_list=False),
113 _e('local-port', is_list=False),
114 _e('protocol', is_list=False),
115 _ct('state', OFControllerStateType, is_list=False),
119 class OFLogicalSwitchControllersType(_Base):
121 _ct('controller', OFControllerType, is_list=True),
125 class OFLogicalSwitchResourcesType(_Base):
127 _e('port', is_list=True),
128 _e('queue', is_list=True),
129 _e('certificate', is_list=False),
130 _e('flow-table', is_list=True),
134 class OFLogicalSwitchType(_Base):
136 _e('id', is_list=False),
137 _ct('capabilities', None, is_list=False),
138 _e('datapath-id', is_list=False),
139 _e('enabled', is_list=False),
140 _e('check-controller-certificate', is_list=False),
141 _e('lost-connection-behavior', is_list=False),
142 _ct('controllers', OFLogicalSwitchControllersType, is_list=False),
143 _ct('resources', OFLogicalSwitchResourcesType, is_list=False),
147 class OFCapableSwitchLogicalSwitchesType(_Base):
149 # this is named 'logical-switch' for OF-Config 1.1.
150 _ct('switch', OFLogicalSwitchType, is_list=True),
154 class OFCapableSwitchType(_Base):
156 _e('id', is_list=False),
157 _e('config-version', is_list=False),
158 _ct('configuration-points', None, is_list=False),
159 _ct('resources', OFCapableSwitchResourcesType, is_list=False),
160 _ct('logical-switches', OFCapableSwitchLogicalSwitchesType,