Committed by
Gerrit Code Review
[ONOS-4879][ONOS-5024][ONOS-5025]TE Topology NBI
The APP introduces IETF TE Topology YANG models as RESTCONF NBI, and it works as an adapter for data conversion between YMS(YANG generated JAVA classes) and TE Topology Core subsystem. The APP implements the following interfaces: IetfNetworkService Interface IetfTopologyService Interface IetfNetworkTopologyService Interface Change-Id: I761ff684bde4b64ca42bb1b0d5b1ddfb8a2377fd
Showing
29 changed files
with
1603 additions
and
0 deletions
... | @@ -79,6 +79,7 @@ | ... | @@ -79,6 +79,7 @@ |
79 | <module>tetopology</module> | 79 | <module>tetopology</module> |
80 | <module>rabbitmq</module> | 80 | <module>rabbitmq</module> |
81 | <module>learning-switch</module> | 81 | <module>learning-switch</module> |
82 | + <module>tenbi</module> | ||
82 | </modules> | 83 | </modules> |
83 | 84 | ||
84 | 85 | ... | ... |
apps/tenbi/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016-present Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
18 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
19 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
20 | + <modelVersion>4.0.0</modelVersion> | ||
21 | + | ||
22 | + <parent> | ||
23 | + <groupId>org.onosproject</groupId> | ||
24 | + <artifactId>onos-apps</artifactId> | ||
25 | + <version>1.8.0-SNAPSHOT</version> | ||
26 | + <relativePath>../pom.xml</relativePath> | ||
27 | + </parent> | ||
28 | + | ||
29 | + <artifactId>onos-app-tenbi</artifactId> | ||
30 | + <packaging>pom</packaging> | ||
31 | + | ||
32 | + <modules> | ||
33 | + <module>topology</module> | ||
34 | + <module>yangmodel</module> | ||
35 | + <module>utils</module> | ||
36 | + </modules> | ||
37 | + | ||
38 | + <description>TE YANG NBI Application</description> | ||
39 | +</project> | ||
40 | + |
apps/tenbi/topology/app.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<app name="org.onosproject.tenbi.topology" origin="HUAWEI" version="${project.version}" | ||
18 | + featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features" | ||
19 | + features="${project.artifactId}"> | ||
20 | + <description>${project.description}</description> | ||
21 | + <artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact> | ||
22 | + <artifact>mvn:${project.groupId}/onos-app-tenbi-yangmodel/${project.version}</artifact> | ||
23 | +</app> | ||
24 | + |
apps/tenbi/topology/features.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> | ||
18 | + <repository>mvn:${project.groupId}/onos-app-tenbi-yangmodel/${project.version}/xml/features</repository> | ||
19 | + <feature name="${project.artifactId}" version="${project.version}" description="${project.description}"> | ||
20 | + <feature>onos-api</feature> | ||
21 | + <feature>onos-app-tenbi-yangmodel</feature> | ||
22 | + <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle> | ||
23 | + <bundle>mvn:${project.groupId}/onos-app-tetopology/${project.version}</bundle> | ||
24 | + <bundle>mvn:${project.groupId}/onos-app-yms-api/${project.version}</bundle> | ||
25 | + <bundle>mvn:${project.groupId}/onos-app-tenbi-utils/${project.version}</bundle> | ||
26 | + </feature> | ||
27 | +</features> |
apps/tenbi/topology/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
18 | + <modelVersion>4.0.0</modelVersion> | ||
19 | + | ||
20 | + <parent> | ||
21 | + <groupId>org.onosproject</groupId> | ||
22 | + <artifactId>onos-app-tenbi</artifactId> | ||
23 | + <version>1.8.0-SNAPSHOT</version> | ||
24 | + <relativePath>../pom.xml</relativePath> | ||
25 | + </parent> | ||
26 | + | ||
27 | + <artifactId>onos-app-tenbi-topology</artifactId> | ||
28 | + <packaging>bundle</packaging> | ||
29 | + | ||
30 | + <description>IETF TE Topology NBI</description> | ||
31 | + | ||
32 | + <properties> | ||
33 | + <onos.app.name>tenbi.topology</onos.app.name> | ||
34 | + <onos.app.origin>HUAWEI</onos.app.origin> | ||
35 | + </properties> | ||
36 | + | ||
37 | + <dependencies> | ||
38 | + <dependency> | ||
39 | + <groupId>org.onosproject</groupId> | ||
40 | + <artifactId>onos-app-tenbi-yangmodel</artifactId> | ||
41 | + <version>${project.version}</version> | ||
42 | + </dependency> | ||
43 | + <dependency> | ||
44 | + <groupId>org.onosproject</groupId> | ||
45 | + <artifactId>onos-app-tenbi-utils</artifactId> | ||
46 | + <version>${project.version}</version> | ||
47 | + </dependency> | ||
48 | + <dependency> | ||
49 | + <groupId>org.onosproject</groupId> | ||
50 | + <artifactId>onlab-junit</artifactId> | ||
51 | + <scope>test</scope> | ||
52 | + </dependency> | ||
53 | + <dependency> | ||
54 | + <groupId>org.onosproject</groupId> | ||
55 | + <artifactId>onos-app-tetopology</artifactId> | ||
56 | + <version>${project.version}</version> | ||
57 | + </dependency> | ||
58 | + <dependency> | ||
59 | + <groupId>org.onosproject</groupId> | ||
60 | + <artifactId>onos-app-yms-api</artifactId> | ||
61 | + <version>${project.version}</version> | ||
62 | + </dependency> | ||
63 | + </dependencies> | ||
64 | + | ||
65 | +</project> |
apps/tenbi/topology/src/main/java/org/onosproject/tenbi/topology/impl/TeTopologyNbiManager.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.tenbi.topology.impl; | ||
17 | + | ||
18 | +import static com.google.common.base.Preconditions.checkNotNull; | ||
19 | + | ||
20 | +import org.apache.felix.scr.annotations.Activate; | ||
21 | +import org.apache.felix.scr.annotations.Component; | ||
22 | +import org.apache.felix.scr.annotations.Deactivate; | ||
23 | +import org.apache.felix.scr.annotations.Reference; | ||
24 | +import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
25 | +import org.apache.felix.scr.annotations.Service; | ||
26 | +import org.onosproject.event.AbstractListenerManager; | ||
27 | +import org.onosproject.tetopology.management.api.TeTopologyService; | ||
28 | +import org.onosproject.teyang.api.OperationType; | ||
29 | +import org.onosproject.teyang.utils.topology.NetworkConverter; | ||
30 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.IetfNetwork; | ||
31 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.IetfNetworkOpParam; | ||
32 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.IetfNetworkService; | ||
33 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.Networks; | ||
34 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev20151208.ietfnetwork.NetworksState; | ||
35 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev20151208.IetfNetworkTopology; | ||
36 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev20151208 | ||
37 | + .IetfNetworkTopologyOpParam; | ||
38 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev20151208 | ||
39 | + .IetfNetworkTopologyService; | ||
40 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20160708.IetfTeTopology; | ||
41 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20160708.IetfTeTopologyOpParam; | ||
42 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20160708 | ||
43 | + .IetfTeTopologyService; | ||
44 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20160708 | ||
45 | + .ietftetopology.IetfTeTopologyEvent; | ||
46 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20160708 | ||
47 | + .ietftetopology.IetfTeTopologyEventListener; | ||
48 | +import org.onosproject.yms.ymsm.YmsService; | ||
49 | +import org.slf4j.Logger; | ||
50 | +import org.slf4j.LoggerFactory; | ||
51 | + | ||
52 | +/** | ||
53 | + * The IETF TE Topology NBI Manager implementation. | ||
54 | + */ | ||
55 | +@Component(immediate = true) | ||
56 | +@Service | ||
57 | +public class TeTopologyNbiManager | ||
58 | + extends AbstractListenerManager<IetfTeTopologyEvent, IetfTeTopologyEventListener> | ||
59 | + implements IetfNetworkService, IetfNetworkTopologyService, IetfTeTopologyService { | ||
60 | + | ||
61 | + private final Logger log = LoggerFactory.getLogger(getClass()); | ||
62 | + | ||
63 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
64 | + protected TeTopologyService teTopologyService; | ||
65 | + | ||
66 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
67 | + protected YmsService ymsService; | ||
68 | + | ||
69 | + @Activate | ||
70 | + protected void activate() { | ||
71 | + // Register 3 services with YMS. | ||
72 | + ymsService.registerService(this, IetfNetworkService.class, null); | ||
73 | + ymsService.registerService(this, IetfNetworkTopologyService.class, null); | ||
74 | + ymsService.registerService(this, IetfTeTopologyService.class, null); | ||
75 | + | ||
76 | + log.info("Started"); | ||
77 | + } | ||
78 | + | ||
79 | + @Deactivate | ||
80 | + protected void deactivate() { | ||
81 | + // Unregister 3 services. | ||
82 | + ymsService.unRegisterService(this, IetfNetworkService.class); | ||
83 | + ymsService.unRegisterService(this, IetfNetworkTopologyService.class); | ||
84 | + ymsService.unRegisterService(this, IetfTeTopologyService.class); | ||
85 | + | ||
86 | + log.info("Stopped"); | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public IetfNetwork getIetfNetwork(IetfNetworkOpParam ietfNetwork) { | ||
91 | + log.info("getIetfNetwork: input {}", ietfNetwork); | ||
92 | + | ||
93 | + checkNotNull(ietfNetwork, "getIetfNetwork: ietfNetwork cannot be null"); | ||
94 | + | ||
95 | + // Get the entire data tree from TE Subsystem core. | ||
96 | + org.onosproject.tetopology.management.api.Networks teNetworks = teTopologyService.getNetworks(); | ||
97 | + | ||
98 | + // Convert the TE Subsystem core data into YANG Objects. | ||
99 | + Networks networks = NetworkConverter.teSubsystem2YangNetworks(teNetworks, OperationType.QUERY); | ||
100 | + NetworksState networkStates = NetworkConverter.teSubsystem2YangNetworkStates(teNetworks, OperationType.QUERY); | ||
101 | + | ||
102 | + IetfNetworkOpParam.IetfNetworkBuilder builder = new IetfNetworkOpParam.IetfNetworkBuilder(); | ||
103 | + IetfNetwork newNetwork = builder.networks(networks) | ||
104 | + .networksState(networkStates) | ||
105 | + .onosYangNodeOperationType(IetfNetworkOpParam.OnosYangNodeOperationType.NONE) | ||
106 | + .build(); | ||
107 | + | ||
108 | + // processSubtreeFiltering() filters the entire data tree based on the | ||
109 | + // user's query and returns the filtered data. | ||
110 | + return ietfNetwork.processSubtreeFiltering(newNetwork, false); | ||
111 | + } | ||
112 | + | ||
113 | + @Override | ||
114 | + public void setIetfNetwork(IetfNetworkOpParam ietfNetwork) { | ||
115 | + // In H release, topology is discovered from south, no NBI Set is supported. | ||
116 | + } | ||
117 | + | ||
118 | + @Override | ||
119 | + public IetfTeTopology getIetfTeTopology(IetfTeTopologyOpParam ietfTeTopology) { | ||
120 | + // unused method. | ||
121 | + return ietfTeTopology; | ||
122 | + } | ||
123 | + | ||
124 | + @Override | ||
125 | + public void setIetfTeTopology(IetfTeTopologyOpParam ietfTeTopology) { | ||
126 | + // unused methods. | ||
127 | + } | ||
128 | + | ||
129 | + @Override | ||
130 | + public IetfTeTopology getAugmentedIetfTeTopologyTeLinkEvent(IetfTeTopologyOpParam ietfTeTopology) { | ||
131 | + // unused methods. | ||
132 | + return ietfTeTopology; | ||
133 | + } | ||
134 | + | ||
135 | + @Override | ||
136 | + public void setAugmentedIetfTeTopologyTeLinkEvent(IetfTeTopologyOpParam augmentedIetfTeTopologyTeLinkEvent) { | ||
137 | + // unused methods. | ||
138 | + } | ||
139 | + | ||
140 | + @Override | ||
141 | + public IetfNetworkTopology getIetfNetworkTopology(IetfNetworkTopologyOpParam ietfNetworkTopology) { | ||
142 | + // unused methods. | ||
143 | + return ietfNetworkTopology; | ||
144 | + } | ||
145 | + | ||
146 | + @Override | ||
147 | + public void setIetfNetworkTopology(IetfNetworkTopologyOpParam ietfNetworkTopology) { | ||
148 | + // unused methods. | ||
149 | + } | ||
150 | + | ||
151 | + @Override | ||
152 | + public IetfNetwork getAugmentedIetfNetworkNetworks(IetfNetworkOpParam ietfNetwork) { | ||
153 | + // unused methods. | ||
154 | + return ietfNetwork; | ||
155 | + } | ||
156 | + | ||
157 | + @Override | ||
158 | + public void setAugmentedIetfNetworkNetworks(IetfNetworkOpParam augmentedIetfNetworkNetworks) { | ||
159 | + // unused methods. | ||
160 | + } | ||
161 | + | ||
162 | +} |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +/** | ||
17 | + * The implementations of IETF TE Topology YANG NBI. | ||
18 | + */ | ||
19 | +package org.onosproject.tenbi.topology.impl; |
apps/tenbi/utils/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
18 | + <modelVersion>4.0.0</modelVersion> | ||
19 | + | ||
20 | + <parent> | ||
21 | + <groupId>org.onosproject</groupId> | ||
22 | + <artifactId>onos-app-tenbi</artifactId> | ||
23 | + <version>1.8.0-SNAPSHOT</version> | ||
24 | + <relativePath>../pom.xml</relativePath> | ||
25 | + </parent> | ||
26 | + | ||
27 | + <artifactId>onos-app-tenbi-utils</artifactId> | ||
28 | + <packaging>bundle</packaging> | ||
29 | + | ||
30 | + <description>IETF TE NBI Utilities</description> | ||
31 | + | ||
32 | + <dependencies> | ||
33 | + <dependency> | ||
34 | + <groupId>org.onosproject</groupId> | ||
35 | + <artifactId>onos-app-tenbi-yangmodel</artifactId> | ||
36 | + <version>${project.version}</version> | ||
37 | + </dependency> | ||
38 | + <dependency> | ||
39 | + <groupId>org.onosproject</groupId> | ||
40 | + <artifactId>onlab-junit</artifactId> | ||
41 | + <scope>test</scope> | ||
42 | + </dependency> | ||
43 | + <dependency> | ||
44 | + <groupId>org.onosproject</groupId> | ||
45 | + <artifactId>onos-app-tetopology</artifactId> | ||
46 | + <version>${project.version}</version> | ||
47 | + </dependency> | ||
48 | + </dependencies> | ||
49 | + | ||
50 | +</project> |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.teyang.api; | ||
17 | + | ||
18 | +/** | ||
19 | + * The operation type. | ||
20 | + */ | ||
21 | +public enum OperationType { | ||
22 | + | ||
23 | + /** | ||
24 | + * The configuration data identified by the element | ||
25 | + * containing this attribute is merged with the configuration | ||
26 | + * at the corresponding level in the configuration datastore. | ||
27 | + */ | ||
28 | + MERGE, | ||
29 | + | ||
30 | + /** | ||
31 | + * The configuration data identified by the element | ||
32 | + * containing this attribute replaces any related configuration | ||
33 | + * in the configuration datastore. If no such configuration | ||
34 | + * data exists in the configuration datastore, it is created. | ||
35 | + */ | ||
36 | + REPLACE, | ||
37 | + | ||
38 | + /** | ||
39 | + * The configuration data identified by the element | ||
40 | + * containing this attribute is added to the configuration if | ||
41 | + * and only if the configuration data does not already exist in | ||
42 | + * the configuration datastore. If the configuration data | ||
43 | + * exists, an error is returned. | ||
44 | + */ | ||
45 | + CREATE, | ||
46 | + | ||
47 | + /** | ||
48 | + * The configuration data identified by the element | ||
49 | + * containing this attribute is deleted from the configuration | ||
50 | + * if and only if the configuration data currently exists in | ||
51 | + * the configuration datastore. If the configuration data does | ||
52 | + * not exist, an error is returned". | ||
53 | + */ | ||
54 | + DELETE, | ||
55 | + | ||
56 | + /** | ||
57 | + * The configuration data identified by the element | ||
58 | + * containing this attribute is deleted from the configuration | ||
59 | + * if the configuration data currently exists in the | ||
60 | + * configuration datastore. If the configuration data does not | ||
61 | + * exist, the "remove" operation is silently ignored by the | ||
62 | + * server. | ||
63 | + */ | ||
64 | + REMOVE, | ||
65 | + | ||
66 | + /** | ||
67 | + * The node is used as a containment node to reach the child node, | ||
68 | + * There is no change in the data store for the values of this node in the | ||
69 | + * edit request. | ||
70 | + */ | ||
71 | + NONE, | ||
72 | + | ||
73 | +// /** | ||
74 | +// * The YANG based request is to edit a config node / subtree in the data | ||
75 | +// * store. | ||
76 | +// */ | ||
77 | +// EDIT_CONFIG, | ||
78 | +// | ||
79 | +// /** | ||
80 | +// * The YANG based request is to query a config node / subtree in the data | ||
81 | +// * store. | ||
82 | +// */ | ||
83 | +// QUERY_CONFIG, | ||
84 | +// | ||
85 | + /** | ||
86 | + * The YANG based request is to query a node / subtree in the data store. | ||
87 | + */ | ||
88 | + QUERY, | ||
89 | + | ||
90 | +// /** | ||
91 | +// * The YANG based request is to execute an RPC defined in YANG. | ||
92 | +// */ | ||
93 | +// RPC, | ||
94 | +// | ||
95 | +// /** | ||
96 | +// * The YANG based request is to execute an RPC defined in YANG. | ||
97 | +// */ | ||
98 | +// NOTIFICATION | ||
99 | +} |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +/** | ||
17 | + * The utility APIs. | ||
18 | + */ | ||
19 | +package org.onosproject.teyang.api; |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.teyang.utils.topology; | ||
17 | + | ||
18 | +import org.onosproject.tetopology.management.api.node.TeStatus; | ||
19 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.TeAdminStatus; | ||
20 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.TeOperStatus; | ||
21 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.teadminstatus.TeAdminStatusEnum; | ||
22 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.teoperstatus.TeOperStatusEnum; | ||
23 | + | ||
24 | +/** | ||
25 | + * The Enum conversion functions. | ||
26 | + */ | ||
27 | +public final class EnumConverter { | ||
28 | + | ||
29 | + // no instantiation | ||
30 | + private EnumConverter() { | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * Converts YANG Operation Status Enum to TE Topology TeStatus Enum. | ||
35 | + * | ||
36 | + * @param opStatus YANG Operation Status | ||
37 | + * @return the equivalent Enum from TE Topology TeStatus or null if not | ||
38 | + * found | ||
39 | + */ | ||
40 | + public static TeStatus yang2TeSubsystemOpStatus(TeOperStatus opStatus) { | ||
41 | + switch (opStatus.enumeration()) { | ||
42 | + case DOWN: | ||
43 | + return TeStatus.DOWN; | ||
44 | + case UP: | ||
45 | + return TeStatus.UP; | ||
46 | + case MAINTENANCE: | ||
47 | + return TeStatus.MAINTENANCE; | ||
48 | + case PREPARING_MAINTENANCE: | ||
49 | + return TeStatus.PREPARING_MAINTENANCE; | ||
50 | + case TESTING: | ||
51 | + return TeStatus.TESTING; | ||
52 | + case UNKNOWN: | ||
53 | + return TeStatus.UNKNOWN; | ||
54 | + default: | ||
55 | + return null; | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Converts YANG TeAdminStatus Enum to TE Topology TeStatus Enum. | ||
61 | + * | ||
62 | + * @param adminStatus YANG Admin Status | ||
63 | + * @return the equivalent Enum from TE Topology TeStatus or null if not | ||
64 | + * found | ||
65 | + */ | ||
66 | + public static TeStatus yang2TeSubsystemAdminStatus(TeAdminStatus adminStatus) { | ||
67 | + switch (adminStatus.enumeration()) { | ||
68 | + case DOWN: | ||
69 | + return TeStatus.DOWN; | ||
70 | + case UP: | ||
71 | + return TeStatus.UP; | ||
72 | + case TESTING: | ||
73 | + return TeStatus.TESTING; | ||
74 | + case MAINTENANCE: | ||
75 | + return TeStatus.MAINTENANCE; | ||
76 | + case PREPARING_MAINTENANCE: | ||
77 | + return TeStatus.PREPARING_MAINTENANCE; | ||
78 | + default: | ||
79 | + return TeStatus.UNKNOWN; | ||
80 | + } | ||
81 | + } | ||
82 | + | ||
83 | + /** | ||
84 | + * Converts TE Topology TeStatus Enum to YANG TeAdminStatus Enum. | ||
85 | + * | ||
86 | + * @param adminStatus TE Topology admin status | ||
87 | + * @return the equivalent Enum from YANG TeAdminStatus or null if not found | ||
88 | + */ | ||
89 | + public static TeAdminStatus teSubsystem2YangAdminStatus(TeStatus adminStatus) { | ||
90 | + switch (adminStatus) { | ||
91 | + case DOWN: | ||
92 | + return TeAdminStatus.of(TeAdminStatusEnum.DOWN); | ||
93 | + case UP: | ||
94 | + return TeAdminStatus.of(TeAdminStatusEnum.UP); | ||
95 | + case TESTING: | ||
96 | + return TeAdminStatus.of(TeAdminStatusEnum.TESTING); | ||
97 | + case MAINTENANCE: | ||
98 | + return TeAdminStatus.of(TeAdminStatusEnum.MAINTENANCE); | ||
99 | + case PREPARING_MAINTENANCE: | ||
100 | + return TeAdminStatus.of(TeAdminStatusEnum.PREPARING_MAINTENANCE); | ||
101 | + case UNKNOWN: | ||
102 | + return null; | ||
103 | + default: | ||
104 | + return null; | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * Converts TE Topology TeStatus Enum to YANG TeOperStatus Enum. | ||
110 | + * | ||
111 | + * @param opStatus TE Topology operation status | ||
112 | + * @return the equivalent Enum from YANG TeOperStatus or null if not found | ||
113 | + */ | ||
114 | + public static TeOperStatus teSubsystem2YangOperStatus(TeStatus opStatus) { | ||
115 | + switch (opStatus) { | ||
116 | + case DOWN: | ||
117 | + return TeOperStatus.of(TeOperStatusEnum.DOWN); | ||
118 | + case UP: | ||
119 | + return TeOperStatus.of(TeOperStatusEnum.UP); | ||
120 | + case TESTING: | ||
121 | + return TeOperStatus.of(TeOperStatusEnum.TESTING); | ||
122 | + case MAINTENANCE: | ||
123 | + return TeOperStatus.of(TeOperStatusEnum.MAINTENANCE); | ||
124 | + case PREPARING_MAINTENANCE: | ||
125 | + return TeOperStatus.of(TeOperStatusEnum.PREPARING_MAINTENANCE); | ||
126 | + case UNKNOWN: | ||
127 | + return TeOperStatus.of(TeOperStatusEnum.UNKNOWN); | ||
128 | + default: | ||
129 | + return null; | ||
130 | + } | ||
131 | + } | ||
132 | + | ||
133 | +} |
This diff is collapsed. Click to expand it.
apps/tenbi/utils/src/main/java/org/onosproject/teyang/utils/topology/NetworkConverter.java
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
apps/tenbi/utils/src/main/java/org/onosproject/teyang/utils/topology/TerminationPointConverter.java
0 → 100644
This diff is collapsed. Click to expand it.
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +/** | ||
17 | + * The utilities for conversions between TE Topology core subsystem and | ||
18 | + * IETF TE Topology Yang generated Java code. | ||
19 | + */ | ||
20 | +package org.onosproject.teyang.utils.topology; |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.teyang.utils.topology; | ||
17 | + | ||
18 | +import static org.junit.Assert.assertEquals; | ||
19 | + | ||
20 | +import org.junit.Before; | ||
21 | +import org.junit.Test; | ||
22 | +import org.onosproject.teyang.api.OperationType; | ||
23 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network | ||
24 | + .rev20151208.ietfnetwork.networks.Network; | ||
25 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.topology.rev20160708.ietftetopology.networks.network.node.AugmentedNwNode; | ||
26 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.TeAdminStatus; | ||
27 | +import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.te.types.rev20160705.ietftetypes.teadminstatus.TeAdminStatusEnum; | ||
28 | + | ||
29 | + | ||
30 | +/** | ||
31 | + * Unit tests for converter functions. | ||
32 | + */ | ||
33 | +public class ConverterTest { | ||
34 | + | ||
35 | + Network output; | ||
36 | + | ||
37 | + @Before | ||
38 | + public void setUp() { | ||
39 | + output = NetworkConverter.teSubsystem2YangNetwork( | ||
40 | + DefaultBuilder.sampleTeSubsystemNetworkBuilder(), | ||
41 | + OperationType.NONE); | ||
42 | + } | ||
43 | + | ||
44 | + @Test | ||
45 | + public void basics() { | ||
46 | + assertEquals("Wrong networkId", | ||
47 | + output.networkId().uri().string(), | ||
48 | + "HUAWEI_NETWORK_NEW"); | ||
49 | + assertEquals("Wrong 1st nodeId", | ||
50 | + output.node().get(0).nodeId().uri().string(), | ||
51 | + "HUAWEI_ROADM_1"); | ||
52 | + assertEquals("Wrong 2dn nodeId", | ||
53 | + output.node().get(1).nodeId().uri().string(), | ||
54 | + "HUAWEI_ROADM_2"); | ||
55 | + AugmentedNwNode augmentedNode = (AugmentedNwNode) output.node().get(0) | ||
56 | + .yangAugmentedInfo(AugmentedNwNode.class); | ||
57 | + | ||
58 | + assertEquals("Wrong adminStatus", | ||
59 | + augmentedNode.te().config().teNodeAttributes().adminStatus(), | ||
60 | + TeAdminStatus.of(TeAdminStatusEnum.UP)); | ||
61 | + } | ||
62 | + | ||
63 | +} |
1 | +/* | ||
2 | + * Copyright 2016-present Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.teyang.utils.topology; | ||
17 | + | ||
18 | +import java.math.BigInteger; | ||
19 | +import java.util.List; | ||
20 | + | ||
21 | +import org.onosproject.tetopology.management.api.DefaultNetwork; | ||
22 | +import org.onosproject.tetopology.management.api.DefaultNetworks; | ||
23 | +import org.onosproject.tetopology.management.api.KeyId; | ||
24 | +import org.onosproject.tetopology.management.api.Network; | ||
25 | +import org.onosproject.tetopology.management.api.Networks; | ||
26 | +import org.onosproject.tetopology.management.api.TeTopologyId; | ||
27 | +import org.onosproject.tetopology.management.api.link.DefaultNetworkLink; | ||
28 | +import org.onosproject.tetopology.management.api.link.LinkProtectionType; | ||
29 | +import org.onosproject.tetopology.management.api.link.NetworkLink; | ||
30 | +import org.onosproject.tetopology.management.api.link.TeLink; | ||
31 | +import org.onosproject.tetopology.management.api.link.TeLinkAccessType; | ||
32 | +import org.onosproject.tetopology.management.api.node.ConnectivityMatrix; | ||
33 | +import org.onosproject.tetopology.management.api.node.DefaultNetworkNode; | ||
34 | +import org.onosproject.tetopology.management.api.node.DefaultTerminationPoint; | ||
35 | +import org.onosproject.tetopology.management.api.node.NetworkNode; | ||
36 | +import org.onosproject.tetopology.management.api.node.TeNetworkTopologyId; | ||
37 | +import org.onosproject.tetopology.management.api.node.TeNode; | ||
38 | +import org.onosproject.tetopology.management.api.node.TeStatus; | ||
39 | +import org.onosproject.tetopology.management.api.node.TerminationPoint; | ||
40 | +import org.onosproject.tetopology.management.api.node.TerminationPointKey; | ||
41 | + | ||
42 | +import com.google.common.collect.Lists; | ||
43 | + | ||
44 | +/** | ||
45 | + * Builds a sample Topology, which consists of two Nodes, one link, | ||
46 | + * and each node has two termination points. | ||
47 | + */ | ||
48 | +public final class DefaultBuilder { | ||
49 | + | ||
50 | + private static final String HUAWEI_NETWORK_NEW = "HUAWEI_NETWORK_NEW"; | ||
51 | + private static final String HUAWEI_ROADM_1 = "HUAWEI_ROADM_1"; | ||
52 | + private static final String CLIENT1_NODE1 = "CLIENT1_NODE1"; | ||
53 | + private static final String LINE1_NODE1 = "LINE1_NODE1"; | ||
54 | + private static final String NODE1_IP = "10.11.12.33"; | ||
55 | + private static final String HUAWEI_ROADM_2 = "HUAWEI_ROADM_2"; | ||
56 | + private static final String CLIENT1_NODE2 = "CLIENT1_NODE2"; | ||
57 | + private static final String LINE1_NODE2 = "LINE1_NODE2"; | ||
58 | + private static final String NODE2_IP = "10.11.12.34"; | ||
59 | + private static final String LINK1FORNETWORK1 = "LINK1FORNETWORK1"; | ||
60 | + private static final String HUAWEI_TE_TOPOLOGY_NEW = "HUAWEI_TE_TOPOLOGY_NEW"; | ||
61 | + | ||
62 | + // no instantiation | ||
63 | + private DefaultBuilder() { | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * Returns a sample TeSubsystem Networks object. | ||
68 | + * | ||
69 | + * @return the Networks object | ||
70 | + */ | ||
71 | + public static Networks sampleTeSubsystemNetworksBuilder() { | ||
72 | + DefaultNetworks defaultNetworks = new DefaultNetworks(); | ||
73 | + List<Network> networks = Lists.newArrayList(); | ||
74 | + networks.add(sampleTeSubsystemNetworkBuilder()); | ||
75 | + defaultNetworks.setNetworks(networks); | ||
76 | + return defaultNetworks; | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * Returns a sample TeSubsystem Network object. | ||
81 | + * | ||
82 | + * @return the Network object | ||
83 | + */ | ||
84 | + public static Network sampleTeSubsystemNetworkBuilder() { | ||
85 | + DefaultNetwork huaweiNetworkNew = new DefaultNetwork(KeyId.keyId(HUAWEI_NETWORK_NEW)); | ||
86 | + huaweiNetworkNew.setServerProvided(true); | ||
87 | + List<NetworkNode> nodes = Lists.newArrayList(); | ||
88 | + | ||
89 | + | ||
90 | + DefaultNetworkNode node1 = new DefaultNetworkNode(KeyId.keyId(HUAWEI_ROADM_1)); | ||
91 | + | ||
92 | + DefaultTerminationPoint tp11 = new DefaultTerminationPoint(KeyId.keyId(CLIENT1_NODE1)); | ||
93 | + DefaultTerminationPoint tp12 = new DefaultTerminationPoint(KeyId.keyId(LINE1_NODE1)); | ||
94 | + | ||
95 | + List<TerminationPoint> tps1 = Lists.newArrayList(); | ||
96 | + tps1.add(tp11); | ||
97 | + tps1.add(tp12); | ||
98 | + node1.setTerminationPoints(tps1); | ||
99 | + | ||
100 | + TeNode teNode1 = new TeNode(NODE1_IP); | ||
101 | + teNode1.setAdminStatus(TeStatus.UP); | ||
102 | + teNode1.setAbstract(false); | ||
103 | + ConnectivityMatrix cMatrix1 = | ||
104 | + new ConnectivityMatrix(1, | ||
105 | + new TerminationPointKey(huaweiNetworkNew.networkId(), | ||
106 | + node1.nodeId(), tp11.id()), | ||
107 | + new TerminationPointKey(huaweiNetworkNew.networkId(), | ||
108 | + node1.nodeId(), tp12.id()), | ||
109 | + true); | ||
110 | + List<ConnectivityMatrix> connMatrices = Lists.newArrayList(); | ||
111 | + connMatrices.add(cMatrix1); | ||
112 | + teNode1.setConnectivityMatrices(connMatrices); | ||
113 | + node1.setTe(teNode1); | ||
114 | + | ||
115 | + DefaultNetworkNode node2 = new DefaultNetworkNode(KeyId.keyId(HUAWEI_ROADM_2)); | ||
116 | + | ||
117 | + DefaultTerminationPoint tp21 = new DefaultTerminationPoint(KeyId.keyId(CLIENT1_NODE2)); | ||
118 | + DefaultTerminationPoint tp22 = new DefaultTerminationPoint(KeyId.keyId(LINE1_NODE2)); | ||
119 | + | ||
120 | + List<TerminationPoint> tps2 = Lists.newArrayList(); | ||
121 | + tps2.add(tp21); | ||
122 | + tps2.add(tp22); | ||
123 | + node2.setTerminationPoints(tps2); | ||
124 | + | ||
125 | + TeNode teNode2 = new TeNode(NODE2_IP); | ||
126 | + teNode1.setAdminStatus(TeStatus.UP); | ||
127 | + teNode1.setAbstract(false); | ||
128 | + ConnectivityMatrix cMatrix2 = | ||
129 | + new ConnectivityMatrix(1, | ||
130 | + new TerminationPointKey(huaweiNetworkNew.networkId(), | ||
131 | + node2.nodeId(), tp21.id()), | ||
132 | + new TerminationPointKey(huaweiNetworkNew.networkId(), | ||
133 | + node2.nodeId(), tp22.id()), | ||
134 | + true); | ||
135 | + List<ConnectivityMatrix> connMatrices2 = Lists.newArrayList(); | ||
136 | + connMatrices.add(cMatrix2); | ||
137 | + teNode1.setConnectivityMatrices(connMatrices2); | ||
138 | + node2.setTe(teNode2); | ||
139 | + | ||
140 | + nodes.add(node1); | ||
141 | + nodes.add(node2); | ||
142 | + huaweiNetworkNew.setNodes(nodes); | ||
143 | + | ||
144 | + List<NetworkLink> links = Lists.newArrayList(); | ||
145 | + | ||
146 | + DefaultNetworkLink link1 = new DefaultNetworkLink(KeyId.keyId(LINK1FORNETWORK1)); | ||
147 | + link1.setSource(new TerminationPointKey(huaweiNetworkNew.networkId(), | ||
148 | + node1.nodeId(), | ||
149 | + tp11.id())); | ||
150 | + link1.setDestination(new TerminationPointKey(huaweiNetworkNew.networkId(), | ||
151 | + node2.nodeId(), | ||
152 | + tp21.id())); | ||
153 | + TeLink teLink1 = new TeLink(BigInteger.valueOf(1)); | ||
154 | + teLink1.setIsAbstract(false); | ||
155 | + teLink1.setAdminStatus(TeStatus.UP); | ||
156 | + teLink1.setAccessType(TeLinkAccessType.POINT_TO_POINT); | ||
157 | + teLink1.setLinkProtectionType(LinkProtectionType.UNPROTECTED); | ||
158 | + List<Long> teSrlgs = Lists.newArrayList(); | ||
159 | + teSrlgs.add(1000L); | ||
160 | + teSrlgs.add(2000L); | ||
161 | + teLink1.setTeSrlgs(teSrlgs); | ||
162 | + link1.setTe(teLink1); | ||
163 | + links.add(link1); | ||
164 | + huaweiNetworkNew.setLinks(links); | ||
165 | + | ||
166 | + TeNetworkTopologyId teNetwork = | ||
167 | + new TeNetworkTopologyId(new TeTopologyId(22222L, 44444L, HUAWEI_TE_TOPOLOGY_NEW)); | ||
168 | + huaweiNetworkNew.setTeTopologyId(teNetwork.getTopologyId()); | ||
169 | + | ||
170 | + return huaweiNetworkNew; | ||
171 | + } | ||
172 | +} |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
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 | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
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 implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +/** | ||
17 | + * The topology utilities test functions. | ||
18 | + * | ||
19 | + */ | ||
20 | +package org.onosproject.teyang.utils.topology; |
apps/tenbi/yangmodel/BUCK
0 → 100644
apps/tenbi/yangmodel/features.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2015 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="@PROJECT-ARTIFACTID-@ONOS-VERSION" > | ||
18 | + <feature name="@PROJECT-ARTIFACTID" version="@ONOS-VERSION" | ||
19 | + description="@PROJECT-DESCRIPTION" > | ||
20 | + <bundle>mvn:@PROJECT-GROUPID/@PROJECT-ARTIFACTID/@ONOS-VERSION</bundle> | ||
21 | + </feature> | ||
22 | +</features> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
apps/tenbi/yangmodel/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!-- | ||
3 | + ~ Copyright 2016 Open Networking Laboratory | ||
4 | + ~ | ||
5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | + ~ you may not use this file except in compliance with the License. | ||
7 | + ~ You may obtain a copy of the License at | ||
8 | + ~ | ||
9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | + ~ | ||
11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | + ~ See the License for the specific language governing permissions and | ||
15 | + ~ limitations under the License. | ||
16 | + --> | ||
17 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
18 | + <modelVersion>4.0.0</modelVersion> | ||
19 | + | ||
20 | + <parent> | ||
21 | + <groupId>org.onosproject</groupId> | ||
22 | + <artifactId>onos-app-tenbi</artifactId> | ||
23 | + <version>1.8.0-SNAPSHOT</version> | ||
24 | + <relativePath>../pom.xml</relativePath> | ||
25 | + </parent> | ||
26 | + | ||
27 | + <artifactId>onos-app-tenbi-yangmodel</artifactId> | ||
28 | + <packaging>bundle</packaging> | ||
29 | + | ||
30 | + <description>IETF TE YANG models</description> | ||
31 | + | ||
32 | + <dependencies> | ||
33 | + <dependency> | ||
34 | + <groupId>org.onosproject</groupId> | ||
35 | + <artifactId>onos-yang-maven-plugin</artifactId> | ||
36 | + <version>1.8</version> | ||
37 | + </dependency> | ||
38 | + <dependency> | ||
39 | + <groupId>org.onosproject</groupId> | ||
40 | + <artifactId>onos-yang-datamodel</artifactId> | ||
41 | + <version>1.8</version> | ||
42 | + </dependency> | ||
43 | + </dependencies> | ||
44 | + | ||
45 | + <build> | ||
46 | + <plugins> | ||
47 | + <plugin> | ||
48 | + <groupId>org.onosproject</groupId> | ||
49 | + <artifactId>onos-yang-maven-plugin</artifactId> | ||
50 | + <version>1.8</version> | ||
51 | + <executions> | ||
52 | + <execution> | ||
53 | + <goals> | ||
54 | + <goal>yang2java</goal> | ||
55 | + </goals> | ||
56 | + </execution> | ||
57 | + </executions> | ||
58 | + </plugin> | ||
59 | + <plugin> | ||
60 | + <groupId>com.google.code.maven-replacer-plugin</groupId> | ||
61 | + <artifactId>replacer</artifactId> | ||
62 | + <version>1.5.3</version> | ||
63 | + <executions> | ||
64 | + <execution> | ||
65 | + <phase>prepare-package</phase> | ||
66 | + <goals> | ||
67 | + <goal>replace</goal> | ||
68 | + </goals> | ||
69 | + </execution> | ||
70 | + </executions> | ||
71 | + <configuration> | ||
72 | + <file>${pom.basedir}/features.xml</file> | ||
73 | + <outputFile>${pom.basedir}/target/features.xml</outputFile> | ||
74 | + <replacements> | ||
75 | + <replacement> | ||
76 | + <token>@ONOS-VERSION</token> | ||
77 | + <value>${project.version}</value> | ||
78 | + </replacement> | ||
79 | + <replacement> | ||
80 | + <token>@PROJECT-GROUPID</token> | ||
81 | + <value>${project.groupId}</value> | ||
82 | + </replacement> | ||
83 | + <replacement> | ||
84 | + <token>@PROJECT-ARTIFACTID</token> | ||
85 | + <value>${project.artifactId}</value> | ||
86 | + </replacement> | ||
87 | + <replacement> | ||
88 | + <token>@PROJECT-DESCRIPTION</token> | ||
89 | + <value>${project.description}</value> | ||
90 | + </replacement> | ||
91 | + <replacement> | ||
92 | + <token>@FEATURE-VERSION</token> | ||
93 | + <value>${project.version}</value> | ||
94 | + </replacement> | ||
95 | + </replacements> | ||
96 | + </configuration> | ||
97 | + </plugin> | ||
98 | + <plugin> | ||
99 | + <groupId>org.codehaus.mojo</groupId> | ||
100 | + <artifactId>build-helper-maven-plugin</artifactId> | ||
101 | + <version>1.9</version> | ||
102 | + <executions> | ||
103 | + <execution> | ||
104 | + <id>attach-artifacts</id> | ||
105 | + <phase>package</phase> | ||
106 | + <goals> | ||
107 | + <goal>attach-artifact</goal> | ||
108 | + </goals> | ||
109 | + <configuration> | ||
110 | + <artifacts> | ||
111 | + <artifact> | ||
112 | + <file>target/features.xml</file> | ||
113 | + <type>xml</type> | ||
114 | + <classifier>features</classifier> | ||
115 | + </artifact> | ||
116 | + </artifacts> | ||
117 | + </configuration> | ||
118 | + </execution> | ||
119 | + </executions> | ||
120 | + </plugin> | ||
121 | + </plugins> | ||
122 | + </build> | ||
123 | + | ||
124 | +</project> |
This diff is collapsed. Click to expand it.
1 | +module ietf-network-topology { | ||
2 | + // yang-version 1.1; | ||
3 | + yang-version 1; | ||
4 | + namespace "urn:ietf:params:xml:ns:yang:ietf-network-topology"; | ||
5 | + prefix lnk; | ||
6 | + import ietf-inet-types { | ||
7 | + prefix inet; | ||
8 | + } | ||
9 | + import ietf-network { | ||
10 | + prefix nd; | ||
11 | + } | ||
12 | + organization | ||
13 | + "IETF I2RS (Interface to the Routing System) Working Group"; | ||
14 | + contact | ||
15 | + "WG Web: <http: tools.ietf.org/wg/i2rs/> | ||
16 | + WG List: <mailto:i2rs@ietf.org> | ||
17 | + WG Chair: Susan Hares | ||
18 | + <mailto:shares@ndzh.com> | ||
19 | + WG Chair: Jeffrey Haas | ||
20 | + <mailto:jhaas@pfrc.org> | ||
21 | + Editor: Alexander Clemm | ||
22 | + <mailto:alex@cisco.com> | ||
23 | + Editor: Jan Medved | ||
24 | + <mailto:jmedved@cisco.com> | ||
25 | + Editor: Robert Varga | ||
26 | + <mailto:rovarga@cisco.com> | ||
27 | + Editor: Tony Tkacik | ||
28 | + <mailto:ttkacik@cisco.com> | ||
29 | + Editor: Nitin Bahadur | ||
30 | + <mailto:nitin_bahadur@yahoo.com> | ||
31 | + Editor: Hariharan Ananthakrishnan | ||
32 | + <mailto:hari@packetdesign.com>"; | ||
33 | + description | ||
34 | + "This module defines a common base model for network topology, | ||
35 | + augmenting the base network model with links to connect nodes, | ||
36 | + as well as termination points to terminate links on nodes. | ||
37 | + Copyright (c) 2015 IETF Trust and the persons identified as | ||
38 | + authors of the code. All rights reserved. | ||
39 | + Redistribution and use in source and binary forms, with or | ||
40 | + without modification, is permitted pursuant to, and subject | ||
41 | + to the license terms contained in, the Simplified BSD License | ||
42 | + set forth in Section 4.c of the IETF Trust's Legal Provisions | ||
43 | + Relating to IETF Documents | ||
44 | + (http: trustee.ietf.org/license-info). | ||
45 | + This version of this YANG module is part of | ||
46 | + draft-ietf-i2rs-yang-network-topo-02; | ||
47 | + see the RFC itself for full legal notices. | ||
48 | + NOTE TO RFC EDITOR: Please replace above reference to | ||
49 | + draft-ietf-i2rs-yang-network-topo-02 with RFC | ||
50 | + number when published (i.e. RFC xxxx)."; | ||
51 | + revision 2015-12-08 { | ||
52 | + description | ||
53 | + "Initial revision. | ||
54 | + NOTE TO RFC EDITOR: Please replace the following reference | ||
55 | + to draft-ietf-i2rs-yang-network-topo-02 with | ||
56 | + RFC number when published (i.e. RFC xxxx)."; | ||
57 | + reference | ||
58 | + "draft-ietf-i2rs-yang-network-topo-02."; | ||
59 | + } | ||
60 | + typedef link-id { | ||
61 | + type inet:uri; | ||
62 | + description | ||
63 | + "An identifier for a link in a topology. | ||
64 | + The identifier SHOULD be chosen such that the same link in a | ||
65 | + real network topology will always be identified through the | ||
66 | + same identifier, even if the model is instantiated in | ||
67 | + separate datastores. An implementation MAY choose to capture | ||
68 | + semantics in the identifier, for example to indicate the type | ||
69 | + of link and/or the type of topology that the link is a part | ||
70 | + of."; | ||
71 | + } | ||
72 | + typedef tp-id { | ||
73 | + type inet:uri; | ||
74 | + description | ||
75 | + "An identifier for termination points on a node. | ||
76 | + The identifier SHOULD be chosen such that the same TP in a | ||
77 | + real network topology will always be identified through the | ||
78 | + same identifier, even if the model is instantiated in | ||
79 | + separate datastores. An implementation MAY choose to capture | ||
80 | + semantics in the identifier, for example to indicate the type | ||
81 | + of TP and/or the type of node and topology that the TP is a | ||
82 | + part of."; | ||
83 | + } | ||
84 | + grouping link-ref { | ||
85 | + description | ||
86 | + "References a link in a specific network."; | ||
87 | + leaf link-ref { | ||
88 | + type leafref { | ||
89 | + path "/nd:networks/nd:network[nd:network-id=current()/../"+ | ||
90 | + "network-ref]/lnk:link/lnk:link-id"; | ||
91 | + require-instance false; | ||
92 | + } | ||
93 | + description | ||
94 | + "A type for an absolute reference a link instance. | ||
95 | + (This type should not be used for relative references. | ||
96 | + In such a case, a relative path should be used instead.)"; | ||
97 | + } | ||
98 | + uses nd:network-ref; | ||
99 | + } | ||
100 | + grouping tp-ref { | ||
101 | + description | ||
102 | + "References a termination point in a specific node."; | ||
103 | + leaf tp-ref { | ||
104 | + type leafref { | ||
105 | + path "/nd:networks/nd:network[nd:network-id=current()/../"+ | ||
106 | + "network-ref]/nd:node[nd:node-id=current()/../"+ | ||
107 | + "node-ref]/lnk:termination-point/lnk:tp-id"; | ||
108 | + require-instance false; | ||
109 | + } | ||
110 | + description | ||
111 | + "A type for an absolute reference to a termination point. | ||
112 | + (This type should not be used for relative references. | ||
113 | + In such a case, a relative path should be used instead.)"; | ||
114 | + } | ||
115 | + uses nd:node-ref; | ||
116 | + } | ||
117 | + augment "/nd:networks/nd:network" { | ||
118 | + description | ||
119 | + "Add links to the network model."; | ||
120 | + list link { | ||
121 | + key "link-id"; | ||
122 | + description | ||
123 | + "A Network Link connects a by Local (Source) node and | ||
124 | + a Remote (Destination) Network Nodes via a set of the | ||
125 | + nodes' termination points. | ||
126 | + As it is possible to have several links between the same | ||
127 | + source and destination nodes, and as a link could | ||
128 | + potentially be re-homed between termination points, to | ||
129 | + ensure that we would always know to distinguish between | ||
130 | + links, every link is identified by a dedicated link | ||
131 | + identifier. | ||
132 | + Note that a link models a point-to-point link, not a | ||
133 | + multipoint link. | ||
134 | + Layering dependencies on links in underlay topologies are | ||
135 | + not represented as the layering information of nodes and of | ||
136 | + termination points is sufficient."; | ||
137 | + container source { | ||
138 | + description | ||
139 | + "This container holds the logical source of a particular | ||
140 | + link."; | ||
141 | + leaf source-node { | ||
142 | + type leafref { | ||
143 | + path "../../../nd:node/nd:node-id"; | ||
144 | + } | ||
145 | + mandatory true; | ||
146 | + description | ||
147 | + "Source node identifier, must be in same topology."; | ||
148 | + } | ||
149 | + leaf source-tp { | ||
150 | + type leafref { | ||
151 | + path "../../../nd:node[nd:node-id=current()/../"+ | ||
152 | + "source-node]/termination-point/tp-id"; | ||
153 | + } | ||
154 | + description | ||
155 | + "Termination point within source node that terminates | ||
156 | + the link."; | ||
157 | + } | ||
158 | + } | ||
159 | + container destination { | ||
160 | + description | ||
161 | + "This container holds the logical destination of a | ||
162 | + particular link."; | ||
163 | + leaf dest-node { | ||
164 | + type leafref { | ||
165 | + path "../../../nd:node/nd:node-id"; | ||
166 | + } | ||
167 | + mandatory true; | ||
168 | + description | ||
169 | + "Destination node identifier, must be in the same | ||
170 | + network."; | ||
171 | + } | ||
172 | + leaf dest-tp { | ||
173 | + type leafref { | ||
174 | + path "../../../nd:node[nd:node-id=current()/../"+ | ||
175 | + "dest-node]/termination-point/tp-id"; | ||
176 | + } | ||
177 | + description | ||
178 | + "Termination point within destination node that | ||
179 | + terminates the link."; | ||
180 | + } | ||
181 | + } | ||
182 | + leaf link-id { | ||
183 | + type link-id; | ||
184 | + description | ||
185 | + "The identifier of a link in the topology. | ||
186 | + A link is specific to a topology to which it belongs."; | ||
187 | + } | ||
188 | + list supporting-link { | ||
189 | + key "network-ref link-ref"; | ||
190 | + description | ||
191 | + "Identifies the link, or links, that this link | ||
192 | + is dependent on."; | ||
193 | + leaf network-ref { | ||
194 | + type leafref { | ||
195 | + path "../../../nd:supporting-network/nd:network-ref"; | ||
196 | + require-instance false; | ||
197 | + } | ||
198 | + description | ||
199 | + "This leaf identifies in which underlay topology | ||
200 | + supporting link is present."; | ||
201 | + } | ||
202 | + leaf link-ref { | ||
203 | + type leafref { | ||
204 | + path "/nd:networks/nd:network[nd:network-id=current()/"+ | ||
205 | + "../network-ref]/link/link-id"; | ||
206 | + require-instance false; | ||
207 | + } | ||
208 | + description | ||
209 | + "This leaf identifies a link which is a part | ||
210 | + of this link's underlay. Reference loops, in which | ||
211 | + a link identifies itself as its underlay, either | ||
212 | + directly or transitively, are not allowed."; | ||
213 | + } | ||
214 | + } | ||
215 | + } | ||
216 | + } | ||
217 | + augment "/nd:networks/nd:network/nd:node" { | ||
218 | + description | ||
219 | + "Augment termination points which terminate links. | ||
220 | + Termination points can ultimately be mapped to interfaces."; | ||
221 | + list termination-point { | ||
222 | + key "tp-id"; | ||
223 | + description | ||
224 | + "A termination point can terminate a link. | ||
225 | + Depending on the type of topology, a termination point | ||
226 | + could, for example, refer to a port or an interface."; | ||
227 | + leaf tp-id { | ||
228 | + type tp-id; | ||
229 | + description | ||
230 | + "Termination point identifier."; | ||
231 | + } | ||
232 | + list supporting-termination-point { | ||
233 | + key "network-ref node-ref tp-ref"; | ||
234 | + description | ||
235 | + "The leaf list identifies any termination points that | ||
236 | + the termination point is dependent on, or maps onto. | ||
237 | + Those termination points will themselves be contained | ||
238 | + in a supporting node. | ||
239 | + This dependency information can be inferred from | ||
240 | + the dependencies between links. For this reason, | ||
241 | + this item is not separately configurable. Hence no | ||
242 | + corresponding constraint needs to be articulated. | ||
243 | + The corresponding information is simply provided by the | ||
244 | + implementing system."; | ||
245 | + leaf network-ref { | ||
246 | + type leafref { | ||
247 | + path "../../../nd:supporting-node/nd:network-ref"; | ||
248 | + require-instance false; | ||
249 | + } | ||
250 | + description | ||
251 | + "This leaf identifies in which topology the | ||
252 | + supporting termination point is present."; | ||
253 | + } | ||
254 | + leaf node-ref { | ||
255 | + type leafref { | ||
256 | + path "../../../nd:supporting-node/nd:node-ref"; | ||
257 | + require-instance false; | ||
258 | + } | ||
259 | + description | ||
260 | + "This leaf identifies in which node the supporting | ||
261 | + termination point is present."; | ||
262 | + } | ||
263 | + leaf tp-ref { | ||
264 | + type leafref { | ||
265 | + path "/nd:networks/nd:network[nd:network-id=current()/"+ | ||
266 | + "../network-ref]/nd:node[nd:node-id=current()/../"+ | ||
267 | + "node-ref]/termination-point/tp-id"; | ||
268 | + require-instance false; | ||
269 | + } | ||
270 | + description | ||
271 | + "Reference to the underlay node, must be in a | ||
272 | + different topology"; | ||
273 | + } | ||
274 | + } | ||
275 | + } | ||
276 | + } | ||
277 | +} |
1 | +module ietf-network { | ||
2 | + // yang-version 1.1; | ||
3 | + yang-version 1; | ||
4 | + namespace "urn:ietf:params:xml:ns:yang:ietf-network"; | ||
5 | + prefix nd; | ||
6 | + import ietf-inet-types { | ||
7 | + prefix inet; | ||
8 | + } | ||
9 | + organization | ||
10 | + "IETF I2RS (Interface to the Routing System) Working Group"; | ||
11 | + contact | ||
12 | + "WG Web: <http: tools.ietf.org/wg/i2rs/> | ||
13 | + WG List: <mailto:i2rs@ietf.org> | ||
14 | + WG Chair: Susan Hares | ||
15 | + <mailto:shares@ndzh.com> | ||
16 | + WG Chair: Jeffrey Haas | ||
17 | + <mailto:jhaas@pfrc.org> | ||
18 | + Editor: Alexander Clemm | ||
19 | + <mailto:alex@cisco.com> | ||
20 | + Editor: Jan Medved | ||
21 | + <mailto:jmedved@cisco.com> | ||
22 | + Editor: Robert Varga | ||
23 | + <mailto:rovarga@cisco.com> | ||
24 | + Editor: Tony Tkacik | ||
25 | + <mailto:ttkacik@cisco.com> | ||
26 | + Editor: Nitin Bahadur | ||
27 | + <mailto:nitin_bahadur@yahoo.com> | ||
28 | + Editor: Hariharan Ananthakrishnan | ||
29 | + <mailto:hari@packetdesign.com>"; | ||
30 | + description | ||
31 | + "This module defines a common base model for a collection | ||
32 | + of nodes in a network. Node definitions are further used | ||
33 | + in network topologies and inventories. | ||
34 | + Copyright (c) 2015 IETF Trust and the persons identified as | ||
35 | + authors of the code. All rights reserved. | ||
36 | + Redistribution and use in source and binary forms, with or | ||
37 | + without modification, is permitted pursuant to, and subject | ||
38 | + to the license terms contained in, the Simplified BSD License | ||
39 | + set forth in Section 4.c of the IETF Trust's Legal Provisions | ||
40 | + Relating to IETF Documents | ||
41 | + (http: trustee.ietf.org/license-info). | ||
42 | + This version of this YANG module is part of | ||
43 | + draft-ietf-i2rs-yang-network-topo-02; | ||
44 | + see the RFC itself for full legal notices. | ||
45 | + NOTE TO RFC EDITOR: Please replace above reference to | ||
46 | + draft-ietf-i2rs-yang-network-topo-02 with RFC | ||
47 | + number when published (i.e. RFC xxxx)."; | ||
48 | + revision 2015-12-08 { | ||
49 | + description | ||
50 | + "Initial revision. | ||
51 | + NOTE TO RFC EDITOR: Please replace the following reference | ||
52 | + to draft-ietf-i2rs-yang-network-topo-02 with | ||
53 | + RFC number when published (i.e. RFC xxxx)."; | ||
54 | + reference | ||
55 | + "draft-ietf-i2rs-yang-network-topo-02"; | ||
56 | + } | ||
57 | + typedef node-id { | ||
58 | + type inet:uri; | ||
59 | + description | ||
60 | + "Identifier for a node."; | ||
61 | + } | ||
62 | + typedef network-id { | ||
63 | + type inet:uri; | ||
64 | + description | ||
65 | + "Identifier for a network."; | ||
66 | + } | ||
67 | + grouping network-ref { | ||
68 | + description | ||
69 | + "Contains the information necessary to reference a network, | ||
70 | + for example an underlay network."; | ||
71 | + leaf network-ref { | ||
72 | + type leafref { | ||
73 | + path "/nd:networks/nd:network/nd:network-id"; | ||
74 | + require-instance false; | ||
75 | + } | ||
76 | + description | ||
77 | + "Used to reference a network, for example an underlay | ||
78 | + network."; | ||
79 | + } | ||
80 | + } | ||
81 | + grouping node-ref { | ||
82 | + description | ||
83 | + "Contains the information necessary to reference a node."; | ||
84 | + leaf node-ref { | ||
85 | + type leafref { | ||
86 | + path "/nd:networks/nd:network[nd:network-id=current()/../"+ | ||
87 | + "network-ref]/nd:node/nd:node-id"; | ||
88 | + require-instance false; | ||
89 | + } | ||
90 | + description | ||
91 | + "Used to reference a node. | ||
92 | + Nodes are identified relative to the network they are | ||
93 | + contained in."; | ||
94 | + } | ||
95 | + uses network-ref; | ||
96 | + } | ||
97 | + container networks { | ||
98 | + description | ||
99 | + "Serves as top-level container for a list of networks."; | ||
100 | + list network { | ||
101 | + key "network-id"; | ||
102 | + description | ||
103 | + "Describes a network. | ||
104 | + A network typically contains an inventory of nodes, | ||
105 | + topological information (augmented through | ||
106 | + network-topology model), as well as layering | ||
107 | + information."; | ||
108 | + container network-types { | ||
109 | + description | ||
110 | + "Serves as an augmentation target. | ||
111 | + The network type is indicated through corresponding | ||
112 | + presence containers augmented into this container."; | ||
113 | + } | ||
114 | + leaf network-id { | ||
115 | + type network-id; | ||
116 | + description | ||
117 | + "Identifies a network."; | ||
118 | + } | ||
119 | + list supporting-network { | ||
120 | + key "network-ref"; | ||
121 | + description | ||
122 | + "An underlay network, used to represent layered network | ||
123 | + topologies."; | ||
124 | + leaf network-ref { | ||
125 | + type leafref { | ||
126 | + path "/networks/network/network-id"; | ||
127 | + require-instance false; | ||
128 | + } | ||
129 | + description | ||
130 | + "References the underlay network."; | ||
131 | + } | ||
132 | + } | ||
133 | + list node { | ||
134 | + key "node-id"; | ||
135 | + description | ||
136 | + "The inventory of nodes of this network."; | ||
137 | + leaf node-id { | ||
138 | + type node-id; | ||
139 | + description | ||
140 | + "Identifies a node uniquely within the containing | ||
141 | + network."; | ||
142 | + } | ||
143 | + list supporting-node { | ||
144 | + key "network-ref node-ref"; | ||
145 | + description | ||
146 | + "Represents another node, in an underlay network, that | ||
147 | + this node is supported by. Used to represent layering | ||
148 | + structure."; | ||
149 | + leaf network-ref { | ||
150 | + type leafref { | ||
151 | + path "../../../supporting-network/network-ref"; | ||
152 | + require-instance false; | ||
153 | + } | ||
154 | + description | ||
155 | + "References the underlay network that the | ||
156 | + underlay node is part of."; | ||
157 | + } | ||
158 | + leaf node-ref { | ||
159 | + type leafref { | ||
160 | + path "/networks/network/node/node-id"; | ||
161 | + require-instance false; | ||
162 | + } | ||
163 | + description | ||
164 | + "References the underlay node itself."; | ||
165 | + } | ||
166 | + } | ||
167 | + } | ||
168 | + } | ||
169 | + } | ||
170 | + container networks-state { | ||
171 | + config false; | ||
172 | + description | ||
173 | + "Serves as top-level container for a list of state information | ||
174 | + for networks"; | ||
175 | + list network { | ||
176 | + key "network-ref"; | ||
177 | + description | ||
178 | + "Data nodes representing operational data and state of | ||
179 | + networks. | ||
180 | + An instance is automatically created for every network | ||
181 | + in the corresponding list under the networks container."; | ||
182 | + uses network-ref; | ||
183 | + leaf server-provided { | ||
184 | + type boolean; | ||
185 | + description | ||
186 | + "Indicates whether the information concerning this | ||
187 | + particular network is populated by the server | ||
188 | + (server-provided true, the general case for network | ||
189 | + information discovered from the server), | ||
190 | + or whether it is configured by a client | ||
191 | + (server-provided true, possible e.g. for | ||
192 | + service overlays managed through a controller)."; | ||
193 | + } | ||
194 | + } | ||
195 | + } | ||
196 | +} |
1 | +module ietf-schedule { | ||
2 | + yang-version 1; | ||
3 | + namespace "urn:ietf:params:xml:ns:yang:ietf-schedule"; | ||
4 | + // replace with IANA namespace when assigned | ||
5 | + | ||
6 | + prefix "sch"; | ||
7 | + | ||
8 | + import ietf-yang-types { | ||
9 | + prefix "yang"; | ||
10 | + } | ||
11 | + | ||
12 | + organization "TBD"; | ||
13 | + contact "TBD"; | ||
14 | + description | ||
15 | + "The model allows time scheduling parameters to be specified."; | ||
16 | + | ||
17 | + revision "2015-10-08" { | ||
18 | + description "Initial revision"; | ||
19 | + reference "TBD"; | ||
20 | + } | ||
21 | + | ||
22 | + /* | ||
23 | + * Groupings | ||
24 | + */ | ||
25 | + | ||
26 | + grouping schedules { | ||
27 | + description | ||
28 | + "A list of schedules defining when a particular | ||
29 | + configuration takes effect."; | ||
30 | + container schedules { | ||
31 | + list schedule { | ||
32 | + key "schedule-id"; | ||
33 | + description "A list of schedule elements."; | ||
34 | + | ||
35 | + leaf schedule-id { | ||
36 | + type uint32; | ||
37 | + description "Identifies the schedule element."; | ||
38 | + } | ||
39 | + leaf start { | ||
40 | + type yang:date-and-time; | ||
41 | + description "Start time."; | ||
42 | + } | ||
43 | + leaf schedule-duration { | ||
44 | + type string { | ||
45 | + pattern | ||
46 | + 'P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?(\d+S)?'; | ||
47 | + } | ||
48 | + description "Schedule duration in ISO 8601 format."; | ||
49 | + } | ||
50 | + leaf repeat-interval { | ||
51 | + type string { | ||
52 | + pattern | ||
53 | + 'R\d*/P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?' | ||
54 | + + '(\d+S)?'; | ||
55 | + } | ||
56 | + description "Repeat interval in ISO 8601 format."; | ||
57 | + } | ||
58 | + } | ||
59 | + } | ||
60 | + } // schedules | ||
61 | +} |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment