Bharat saraswal
Committed by Gerrit Code Review

[ONOS-5084],[ONOS-5083] YANG schema registry for YMS

Change-Id: I88394307cb9be30237be0bb17e013d7af88a607c
Showing 29 changed files with 1859 additions and 25 deletions
BUNDLES = [
'//apps/yms/api:onos-apps-yms-api',
'//apps/yms/app:onos-apps-yms-app',
]
onos_app(
......
......@@ -26,6 +26,7 @@ import org.onosproject.yms.ydt.YdtResponse;
import org.onosproject.yms.ydt.YdtWalker;
import org.onosproject.yms.ydt.YmsOperationType;
import org.onosproject.yms.ynh.YangNotificationService;
import org.onosproject.yms.ysr.YangModuleIdentifier;
import org.onosproject.yms.ysr.YangModuleLibrary;
/**
......@@ -310,11 +311,11 @@ public interface YmsService {
* The server can optionally support retrieval of the YANG modules it
* supports.
*
* @param moduleName YANG module name.
* @param moduleNamespace namespace in which the module is defined.
*
* @param moduleIdentifier module's identifier
* @return YANG file contents of the requested YANG module.
*/
String getYangFile(String moduleName, String moduleNamespace);
String getYangFile(YangModuleIdentifier moduleIdentifier);
/**
* Register protocol specific default CODEC. This is can be used by 1st
......
......@@ -28,11 +28,11 @@ public interface YangModuleIdentifier {
*
* @return the name of the YANG module
*/
String getModuleName();
String moduleName();
/**
* Retrieves revision of the YANG module.
*
* <p>
* Reference RFC 7895
* Each YANG module and submodule within the library has a
* revision. This is derived from the most recent revision statement
......@@ -42,5 +42,5 @@ public interface YangModuleIdentifier {
*
* @return revision of the YANG module
*/
String getRevision();
String revision();
}
......
......@@ -48,7 +48,7 @@ public interface YangModuleInformation {
*
* @return YANG modules identifier
*/
YangModuleIdentifier getModuleIdentifier();
YangModuleIdentifier moduleIdentifier();
/**
* Retrieves the YANG modules namespace.
......@@ -56,7 +56,7 @@ public interface YangModuleInformation {
*
* @return YANG modules namespace
*/
String getNamespace();
String namespace();
/**
* Reference RFC 7895
......@@ -66,7 +66,7 @@ public interface YangModuleInformation {
*
* @return list of YANG features
*/
List<String> getFeatureList();
List<String> featureList();
/**
* Retrieves the list of submodules in the module.
......@@ -78,5 +78,5 @@ public interface YangModuleInformation {
*
* @return list of submodules in the module
*/
List<YangModuleIdentifier> getSubModuleIdentifier();
List<YangModuleIdentifier> subModuleIdentifiers();
}
......
......@@ -63,7 +63,7 @@ public interface YangModuleLibrary {
*
* @return module set id of the YANG library
*/
String getModuleSetId();
String moduleSetId();
/**
* Retrieves the current list of YANG modules supported in the server.
......@@ -80,5 +80,5 @@ public interface YangModuleLibrary {
*
* @return the current list of YANG modules supported in the server
*/
List<YangModuleInformation> getYangModuleList();
List<YangModuleInformation> yangModuleList();
}
......
COMPILE_DEPS = [
'//lib:CORE_DEPS',
'//apps/yms/api:onos-apps-yms-api',
]
osgi_jar_with_tests(
deps = COMPILE_DEPS,
)
......@@ -34,23 +34,87 @@
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-yms-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-yang-maven-plugin</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-yang-datamodel</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<classifier>tests</classifier>
<artifactId>onlab-osgi</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.osgi/spring-osgi-mock -->
<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>spring-osgi-mock</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Private-Package>
org.onosproject.yangutils.datamodel.*,
org.onosproject.yangutils.translator.*,
org.onosproject.yangutils.linker.*,
org.onosproject.yangutils.utils.*
</Private-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-yang-maven-plugin</artifactId>
<version>1.8</version>
<configuration>
<yangFilesDir>src/test/resources/</yangFilesDir>
</configuration>
<executions>
<execution>
<goals>
<goal>yang2java</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
......
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ymsm;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.core.IdGenerator;
import org.onosproject.yms.app.ynh.YangNotificationExtendedService;
import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry;
import org.onosproject.yms.app.ysr.YangSchemaRegistry;
import org.onosproject.yms.ych.YangCodecHandler;
import org.onosproject.yms.ych.YangDataTreeCodec;
import org.onosproject.yms.ych.YangProtocolEncodingFormat;
import org.onosproject.yms.ydt.YdtBuilder;
import org.onosproject.yms.ydt.YdtResponse;
import org.onosproject.yms.ydt.YdtWalker;
import org.onosproject.yms.ydt.YmsOperationType;
import org.onosproject.yms.ymsm.YmsService;
import org.onosproject.yms.ynh.YangNotificationService;
import org.onosproject.yms.ysr.YangModuleIdentifier;
import org.onosproject.yms.ysr.YangModuleLibrary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static org.onlab.util.Tools.groupedThreads;
/**
* Represents implementation of YANG management system manager.
*/
@Service
@Component(immediate = true)
public class YmsManager
implements YmsService {
private final Logger log = LoggerFactory.getLogger(getClass());
private static final String APP_ID = "org.onosproject.app.yms";
private static final String MODULE_ID = "module-id";
private ApplicationId appId;
private YangSchemaRegistry schemaRegistry;
//module id generator should be used to generate a new module id for
//each YSR instance. So YCH also should generate it.
private IdGenerator moduleIdGenerator;
private ExecutorService schemaRegistryExecutor;
private YangNotificationExtendedService ynhExtendedService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected CoreService coreService;
@Activate
public void activate() {
appId = coreService.registerApplication(APP_ID);
moduleIdGenerator = coreService.getIdGenerator(MODULE_ID);
schemaRegistry = new DefaultYangSchemaRegistry(String.valueOf(
moduleIdGenerator.getNewId()));
schemaRegistryExecutor =
Executors.newSingleThreadExecutor(groupedThreads(
"onos/apps/yang-management-system/schema-registry",
"schema-registry-handler", log));
log.info("Started");
}
@Deactivate
public void deactivate() {
((DefaultYangSchemaRegistry) schemaRegistry).flushYsrData();
schemaRegistryExecutor.shutdown();
// TODO implementation for other components.
log.info("Stopped");
}
@Override
public YdtBuilder getYdtBuilder(String logicalRootName,
String rootNamespace,
YmsOperationType operationType) {
return null;
}
@Override
public YdtBuilder getYdtBuilder(String logicalRootName,
String rootNamespace,
YmsOperationType operationType,
Object schemaRegistryForYdt) {
return null;
}
@Override
public YdtWalker getYdtWalker() {
return null;
}
@Override
public YdtResponse executeOperation(YdtBuilder operationRequest) {
return null;
}
@Override
public YangNotificationService getYangNotificationService() {
return ynhExtendedService;
}
/**
* Returns YANG notification extended service.
*
* @return YANG notification extended service
*/
private YangNotificationExtendedService getYnhExtendedService() {
return ynhExtendedService;
}
@Override
public YangModuleLibrary getYangModuleLibrary() {
return ((DefaultYangSchemaRegistry) schemaRegistry).getLibrary();
}
@Override
public String getYangFile(YangModuleIdentifier moduleIdentifier) {
return ((DefaultYangSchemaRegistry) schemaRegistry)
.getYangFile(moduleIdentifier);
}
@Override
public void registerDefaultCodec(YangDataTreeCodec defaultCodec,
YangProtocolEncodingFormat dataFormat) {
}
@Override
public void registerService(Object yangManager, Class<?> yangService,
List<String> supportedFeatureList) {
//perform registration of service
schemaRegistryExecutor.execute(() -> schemaRegistry
.registerApplication(yangManager, yangService,
getYnhExtendedService()));
}
@Override
public void unRegisterService(Object appManager, Class<?> yangService) {
schemaRegistry.unRegisterApplication(appManager, yangService);
}
@Override
public YangCodecHandler getYangCodecHandler() {
return null;
}
/**
* Returns schema registry.
*
* @return schema registry
*/
public YangSchemaRegistry getSchemaRegistry() {
return schemaRegistry;
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Provides implementation of YANG application management system manager. YMSM is manager
* of the YANG Core, it manages interaction between application and protocols.
*/
package org.onosproject.yms.app.ymsm;
/*
* Copyright 2015-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ynh;
import org.onosproject.event.ListenerService;
import org.onosproject.yms.ynh.YangNotificationService;
/**
* Abstraction of an entity which provides interfaces to YANG extended notification
* service. It provides extended interfaces required by YMS internal modules.
* Application registers their schema with YMSM, YMSM delegates the registration
* request to YSR. YSR then looks for the presence of notification in application
* schema, presence of notification will trigger YSR to ask YANG extended notification
* service to register it as a listener to that application events.
*/
public interface YangNotificationExtendedService extends YangNotificationService {
/**
* Registers as listener with application. This is called by YSR when it
* detects notification presence in application YANG file at the time when
* application registers it's schema with YMS.
*
* @param appObject application object
*/
void registerAsListener(ListenerService appObject);
// TODO handle scenario when multiple services are implemented by single manager.
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Provides implementation of YANG notification handler. YNH handles notification
* from the application and provide it to the protocols.
*/
package org.onosproject.yms.app.ynh;
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ysr;
import org.onosproject.yms.ysr.YangModuleIdentifier;
import java.util.Comparator;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Representation of default YANG module identifier.
*/
class DefaultYangModuleIdentifier implements YangModuleIdentifier,
Comparator<YangModuleIdentifier> {
private final String moduleName;
private final String revision;
/**
* Creates an instance of YANG module identifier.
*
* @param moduleName module's name
* @param revision module's revision
*/
DefaultYangModuleIdentifier(String moduleName, String revision) {
this.moduleName = moduleName;
this.revision = revision;
}
@Override
public String moduleName() {
return moduleName;
}
@Override
public String revision() {
return revision;
}
@Override
public int hashCode() {
return Objects.hash(moduleName, revision);
}
@Override
public int compare(YangModuleIdentifier id1, YangModuleIdentifier id2) {
int compare = id1.moduleName().compareTo(id2.moduleName());
if (compare != 0) {
return compare;
}
return id1.revision().compareTo(id2.revision());
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultYangModuleIdentifier) {
DefaultYangModuleIdentifier that = (DefaultYangModuleIdentifier) obj;
return Objects.equals(moduleName, that.moduleName) &&
Objects.equals(revision, that.revision);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("moduleName", moduleName)
.add("revision", revision)
.toString();
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ysr;
import com.google.common.collect.ImmutableList;
import org.onosproject.yms.ysr.YangModuleIdentifier;
import org.onosproject.yms.ysr.YangModuleInformation;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Representation of default YANG module information.
*/
class DefaultYangModuleInformation implements YangModuleInformation {
private final YangModuleIdentifier moduleIdentifier;
private final String nameSpace;
private final List<String> features;
private final List<YangModuleIdentifier> subModuleIdentifiers;
/**
* Creates an instance of YANG module information.
*
* @param moduleIdentifier module identifier
* @param nameSpace name space of module
*/
DefaultYangModuleInformation(YangModuleIdentifier moduleIdentifier,
String nameSpace) {
this.moduleIdentifier = moduleIdentifier;
this.nameSpace = nameSpace;
subModuleIdentifiers = new ArrayList<>();
features = new ArrayList<>();
}
@Override
public YangModuleIdentifier moduleIdentifier() {
return moduleIdentifier;
}
@Override
public String namespace() {
return nameSpace;
}
@Override
public List<String> featureList() {
return ImmutableList.copyOf(features);
}
@Override
public List<YangModuleIdentifier> subModuleIdentifiers() {
return ImmutableList.copyOf(subModuleIdentifiers);
}
/**
* Adds to YANG sub module identifier list.
*
* @param subModuleIdentifier YANG sub module identifier
*/
void addSubModuleIdentifiers(YangModuleIdentifier subModuleIdentifier) {
subModuleIdentifiers.add(subModuleIdentifier);
}
@Override
public int hashCode() {
return Objects.hash(moduleIdentifier, subModuleIdentifiers, nameSpace, features);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultYangModuleInformation) {
DefaultYangModuleInformation that = (DefaultYangModuleInformation) obj;
return Objects.equals(moduleIdentifier, that.moduleIdentifier) &&
Objects.equals(nameSpace, that.nameSpace) &&
Objects.equals(features, that.features) &&
Objects.equals(subModuleIdentifiers, that.subModuleIdentifiers);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("yangModuleIdentifier", moduleIdentifier)
.add("nameSpace", nameSpace)
.add("features", features)
.add("yangModuleIdentifiers", subModuleIdentifiers)
.toString();
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ysr;
import com.google.common.collect.ImmutableList;
import org.onosproject.yms.ysr.YangModuleInformation;
import org.onosproject.yms.ysr.YangModuleLibrary;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Representation of default YANG module library.
*/
class DefaultYangModuleLibrary implements YangModuleLibrary {
private final String moduleSetId;
private final List<YangModuleInformation> moduleInformation;
/**
* Creates an instance of YANG module library.
*
* @param moduleSetId module id
*/
DefaultYangModuleLibrary(String moduleSetId) {
this.moduleSetId = moduleSetId;
moduleInformation = new ArrayList<>();
}
@Override
public String moduleSetId() {
return moduleSetId;
}
@Override
public List<YangModuleInformation> yangModuleList() {
return ImmutableList.copyOf(moduleInformation);
}
/**
* Adds module information.
*
* @param information module information
*/
void addModuleInformation(YangModuleInformation information) {
moduleInformation.add(information);
}
@Override
public int hashCode() {
return Objects.hash(moduleInformation, moduleSetId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultYangModuleLibrary) {
DefaultYangModuleLibrary that = (DefaultYangModuleLibrary) obj;
return Objects.equals(moduleInformation, that.moduleInformation) &&
Objects.equals(moduleSetId, that.moduleSetId);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("moduleInformation", moduleInformation)
.add("moduleId", moduleSetId)
.toString();
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ysr;
import org.onosproject.yangutils.datamodel.YangSchemaNode;
import org.onosproject.yms.app.ynh.YangNotificationExtendedService;
/**
* Abstraction of entity which provides interfaces to YANG schema registry.
*/
public interface YangSchemaRegistry {
/**
* Registers applications to YMS.
*
* @param managerObject application's object
* @param serviceClass service class which needs to be
* registered
* @param notificationExtendedService notification extended service to
* register application object with YNH
*/
void registerApplication(Object managerObject, Class<?> serviceClass,
YangNotificationExtendedService
notificationExtendedService);
/**
* Unregisters applications to YMS.
*
* @param managerObject application's object
* @param serviceClass service class which needs to be unregistered
*/
void unRegisterApplication(Object managerObject, Class<?> serviceClass);
/**
* Returns application's implementation's class object.
*
* @param yangSchemaNode application's schema node
* @return application's implementation's class object
*/
Object getRegisteredApplication(YangSchemaNode yangSchemaNode);
/**
* Returns YANG schema node using schema name.
*
* @param schemaName module name.
* @return YANG schema node using schema name
*/
YangSchemaNode getYangSchemaNodeUsingSchemaName(String schemaName);
/**
* Returns YANG schema nodes using application name.
*
* @param appName application's service name
* @return YANG schema nodes using application name
*/
YangSchemaNode getYangSchemaNodeUsingAppName(String appName);
/**
* Returns YANG schema nodes using root interface file name.
*
* @param rootInterfaceFileName name of generated interface file
* for root node
* @return YANG schema nodes using root interface file name
*/
YangSchemaNode
getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName(
String rootInterfaceFileName);
/**
* Returns YANG schema nodes using root op param file name.
*
* @param rootOpParamFileName name of generated op param file for root node
* @return YANG schema nodes using root op param file name
*/
YangSchemaNode
getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName(
String rootOpParamFileName);
/**
* Returns YANG schema node of root for notifications.
*
* @param eventSubject event subject
* @return YANG schema node of root for notifications
*/
YangSchemaNode getRootYangSchemaNodeForNotification(String eventSubject);
/**
* Returns registered service class.
*
* @param schemaNode YANG schema node
* @param appName application's name
* @return registered service class
*/
Class<?> getRegisteredClass(YangSchemaNode schemaNode, String appName);
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ysr;
import com.google.common.collect.ImmutableMap;
import org.onosproject.yangutils.datamodel.YangSchemaNode;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* Represents registered application's context for YANG schema registry.
*/
public class YsrAppContext {
/**
* Current application's YANG schema node.
*/
private YangSchemaNode curNode;
/**
* Current application's YANG schema node with different revision store.
*/
private final ConcurrentMap<String, YangSchemaNode>
multiRevisionSchemaNodeStore;
/**
* Current application's object.
*/
private Object appObject;
/**
* Jar file path.
*/
private String jarPath;
/**
* If for current object notification is registered.
*/
private boolean isNotificationRegistered;
/**
* Creates an instance of YANG schema registry application context.
*/
YsrAppContext() {
multiRevisionSchemaNodeStore = new ConcurrentHashMap<>();
}
/**
* Returns current application's object.
*
* @return current application's object
*/
Object appObject() {
return appObject;
}
/**
* Sets current application's object.
*
* @param appObject current application's object
*/
void appObject(Object appObject) {
this.appObject = appObject;
}
/**
* Returns current application's YANG schema node.
*
* @return current application's YANG schema node
*/
YangSchemaNode curNode() {
return curNode;
}
/**
* Sets current application's schema node.
*
* @param node current schema's node
*/
void curNode(YangSchemaNode node) {
curNode = node;
}
/**
* Returns jar file path.
*
* @return jar file path
*/
String jarPath() {
return jarPath;
}
/**
* Sets jar file path.
*
* @param jarPath jar file path
*/
void jarPath(String jarPath) {
this.jarPath = jarPath;
}
@Override
public int hashCode() {
return Objects.hash(curNode, appObject);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof YsrAppContext) {
YsrAppContext that = (YsrAppContext) obj;
return Objects.equals(curNode, that.curNode) &&
Objects.equals(appObject, that.appObject);
}
return false;
}
/**
* Returns true if for application object notification is registered.
*
* @return true if for application object notification is registered
*/
boolean isNotificationRegistered() {
return isNotificationRegistered;
}
/**
* Sets true if for application object notification is registered.
*
* @param notificationRegistered true if for application object notification is registered
*/
void setNotificationRegistered(boolean notificationRegistered) {
isNotificationRegistered = notificationRegistered;
}
/**
* Returns YANG schema node store for specific revision.
*
* @return YANG schema node store for specific revision
*/
Map<String, YangSchemaNode> getYangSchemaNodeForRevisionStore() {
return ImmutableMap.copyOf(multiRevisionSchemaNodeStore);
}
/**
* Returns a schema node for specific revision from store.
*
* @param nodeNameWithRevision schema node name for specific revision
* @return schema node for specific revision.
*/
YangSchemaNode getSchemaNodeForRevisionStore(String nodeNameWithRevision) {
return multiRevisionSchemaNodeStore.get(nodeNameWithRevision);
}
/**
* Removes a schema node of specific revision from store.
*
* @param nodeNameWithRevision schema node name for specific revision
*/
void removeSchemaNodeForRevisionStore(String nodeNameWithRevision) {
multiRevisionSchemaNodeStore.remove(nodeNameWithRevision);
}
/**
* Adds schema node with revision from store.
*
* @param nodeNameWithRevision schema node name for specific revision
* @param schemaNode schema node for specific revision
*/
void addSchemaNodeWithRevisionStore(String nodeNameWithRevision, YangSchemaNode schemaNode) {
multiRevisionSchemaNodeStore.put(nodeNameWithRevision, schemaNode);
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Provides implementation of YANG Schema Registry. YSR maintains the schema
* information registry corresponding to registered app.
*/
package org.onosproject.yms.app.ysr;
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ysr;
import org.onosproject.event.ListenerRegistry;
import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.IetfNetwork2;
import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.IetfNetwork2OpParam;
import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.IetfNetwork2Service;
import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.ietfnetwork2.IetfNetwork2Event;
import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network2.rev20151208.ietfnetwork2.IetfNetwork2EventListener;
/**
* Represent mock implementation for services.
*/
public class MockIetfManager
extends ListenerRegistry<IetfNetwork2Event, IetfNetwork2EventListener>
implements IetfNetwork2Service {
@Override
public IetfNetwork2 getIetfNetwork2(IetfNetwork2OpParam ietfNetwork2) {
return null;
}
@Override
public void setIetfNetwork2(IetfNetwork2OpParam ietfNetwork2) {
}
}
/*
* Copyright 2016-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yms.app.ysr;
import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network1.rev20151208.IetfNetwork1Service;
import org.onosproject.yangutils.datamodel.YangSchemaNode;
import java.io.File;
import java.io.IOException;
import java.util.Set;
import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
import static org.onosproject.yangutils.utils.UtilConstants.TEMP;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
/**
* Represents mock bundle context. provides bundle context for YSR to do unit
* testing.
*/
public class TestYangSchemaNodeProvider {
private static final String FS = File.separator;
private static final String PATH = System.getProperty("user.dir") +
FS + "target" + FS + "classes" + FS;
private static final String SER_FILE_PATH = "yang" + FS + "resources" +
FS + "YangMetaData.ser";
private static final String TEMP_FOLDER_PATH = PATH + TEMP;
private final DefaultYangSchemaRegistry defaultYangSchemaRegistry =
new DefaultYangSchemaRegistry("module-id");
/**
* Creates an instance of mock bundle context.
*/
public TestYangSchemaNodeProvider() {
}
/**
* Process YANG schema node for a application.
*
* @param appObject application object
*/
public void processSchemaRegistry(Object appObject) {
Set<YangSchemaNode> appNode = defaultYangSchemaRegistry
.deSerializeDataModel(PATH + SER_FILE_PATH);
YsrAppContext appContext = new YsrAppContext();
defaultYangSchemaRegistry.ysrContextForSchemaStore(appContext);
defaultYangSchemaRegistry
.setClassLoader(this.getClass().getClassLoader());
String appName;
for (YangSchemaNode node : appNode) {
defaultYangSchemaRegistry.processApplicationContext(node);
defaultYangSchemaRegistry.ysrAppContext().appObject(appObject);
defaultYangSchemaRegistry.ysrContextForAppStore()
.appObject(appObject);
defaultYangSchemaRegistry.ysrContextForSchemaStore()
.appObject(appObject);
appName = node.getJavaPackage() + PERIOD +
getCapitalCase(node.getJavaClassNameOrBuiltInType());
storeClasses(appName);
}
try {
deleteDirectory(TEMP_FOLDER_PATH);
} catch (IOException e) {
}
}
/**
* Stores test generated class to YSR store.
*
* @param name name of class
*/
private void storeClasses(String name) {
ClassLoader classLoader = this.getClass().getClassLoader();
if (getDefaultYangSchemaRegistry().verifyClassExistence(name)) {
try {
Class<?> nodeClass = classLoader.loadClass(name);
getDefaultYangSchemaRegistry().updateServiceClass(nodeClass);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
/**
* Unregisters services.
*
* @param appName application name
*/
public void unregisterService(String appName) {
if (getDefaultYangSchemaRegistry().verifyClassExistence(appName)) {
try {
Class<?> curClass = Class.forName(appName);
getDefaultYangSchemaRegistry()
.unRegisterApplication(null, curClass);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
/**
* Returns schema registry.
*
* @return schema registry
*/
public DefaultYangSchemaRegistry getDefaultYangSchemaRegistry() {
return defaultYangSchemaRegistry;
}
/**
* Process registration of a service.
*/
public void processRegistrationOfApp() {
getDefaultYangSchemaRegistry()
.processRegistration(IetfNetwork1Service.class,
new MockIetfManager(), "target");
}
}
module ietf-network4 {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
prefix nd;
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
WG Chair: Susan Hares
<mailto:shares@ndzh.com>
WG Chair: Jeffrey Haas
<mailto:jhaas@pfrc.org>
Editor: Alexander Clemm
<mailto:alex@cisco.com>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:rovarga@cisco.com>
Editor: Tony Tkacik
<mailto:ttkacik@cisco.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a common base model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2015 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of
draft-ietf-i2rs-yang-network-topo-02;
see the RFC itself for full legal notices.
NOTE TO RFC EDITOR: Please replace above reference to
draft-ietf-i2rs-yang-network-topo-02 with RFC
number when published (i.e. RFC xxxx).";
notification network-up {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
notification network-down {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
}
module ietf-network4 {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
prefix nd;
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
WG Chair: Susan Hares
<mailto:shares@ndzh.com>
WG Chair: Jeffrey Haas
<mailto:jhaas@pfrc.org>
Editor: Alexander Clemm
<mailto:alex@cisco.com>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:rovarga@cisco.com>
Editor: Tony Tkacik
<mailto:ttkacik@cisco.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a common base model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2015 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of
draft-ietf-i2rs-yang-network-topo-02;
see the RFC itself for full legal notices.
NOTE TO RFC EDITOR: Please replace above reference to
draft-ietf-i2rs-yang-network-topo-02 with RFC
number when published (i.e. RFC xxxx).";
revision 2015-12-08 {
description
"Initial revision.
NOTE TO RFC EDITOR: Please replace the following reference
to draft-ietf-i2rs-yang-network-topo-02 with
RFC number when published (i.e. RFC xxxx).";
reference
"draft-ietf-i2rs-yang-network-topo-02";
}
notification network-up {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
notification network-down {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
}
module ietf-network4 {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
prefix nd;
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
WG Chair: Susan Hares
<mailto:shares@ndzh.com>
WG Chair: Jeffrey Haas
<mailto:jhaas@pfrc.org>
Editor: Alexander Clemm
<mailto:alex@cisco.com>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:rovarga@cisco.com>
Editor: Tony Tkacik
<mailto:ttkacik@cisco.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a common base model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2015 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of
draft-ietf-i2rs-yang-network-topo-02;
see the RFC itself for full legal notices.
NOTE TO RFC EDITOR: Please replace above reference to
draft-ietf-i2rs-yang-network-topo-02 with RFC
number when published (i.e. RFC xxxx).";
revision 2016-12-08 {
description
"Initial revision.
NOTE TO RFC EDITOR: Please replace the following reference
to draft-ietf-i2rs-yang-network-topo-02 with
RFC number when published (i.e. RFC xxxx).";
reference
"draft-ietf-i2rs-yang-network-topo-02";
}
notification network-up {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
notification network-down {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
}
module ietf-network4 {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
prefix nd;
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
WG Chair: Susan Hares
<mailto:shares@ndzh.com>
WG Chair: Jeffrey Haas
<mailto:jhaas@pfrc.org>
Editor: Alexander Clemm
<mailto:alex@cisco.com>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:rovarga@cisco.com>
Editor: Tony Tkacik
<mailto:ttkacik@cisco.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a common base model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2015 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of
draft-ietf-i2rs-yang-network-topo-02;
see the RFC itself for full legal notices.
NOTE TO RFC EDITOR: Please replace above reference to
draft-ietf-i2rs-yang-network-topo-02 with RFC
number when published (i.e. RFC xxxx).";
revision 2014-12-08 {
description
"Initial revision.
NOTE TO RFC EDITOR: Please replace the following reference
to draft-ietf-i2rs-yang-network-topo-02 with
RFC number when published (i.e. RFC xxxx).";
reference
"draft-ietf-i2rs-yang-network-topo-02";
}
notification network-up {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
notification network-down {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
}
module ietf-network4 {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network4";
prefix nd;
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
WG Chair: Susan Hares
<mailto:shares@ndzh.com>
WG Chair: Jeffrey Haas
<mailto:jhaas@pfrc.org>
Editor: Alexander Clemm
<mailto:alex@cisco.com>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:rovarga@cisco.com>
Editor: Tony Tkacik
<mailto:ttkacik@cisco.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a common base model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2015 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of
draft-ietf-i2rs-yang-network-topo-02;
see the RFC itself for full legal notices.
NOTE TO RFC EDITOR: Please replace above reference to
draft-ietf-i2rs-yang-network-topo-02 with RFC
number when published (i.e. RFC xxxx).";
revision 2017-12-08 {
description
"Initial revision.
NOTE TO RFC EDITOR: Please replace the following reference
to draft-ietf-i2rs-yang-network-topo-02 with
RFC number when published (i.e. RFC xxxx).";
reference
"draft-ietf-i2rs-yang-network-topo-02";
}
container network {
leaf ip {
type int32;
}
}
}
module ietf-network1 {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network1";
prefix nd;
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
WG Chair: Susan Hares
<mailto:shares@ndzh.com>
WG Chair: Jeffrey Haas
<mailto:jhaas@pfrc.org>
Editor: Alexander Clemm
<mailto:alex@cisco.com>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:rovarga@cisco.com>
Editor: Tony Tkacik
<mailto:ttkacik@cisco.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a common base model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2015 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of
draft-ietf-i2rs-yang-network-topo-02;
see the RFC itself for full legal notices.
NOTE TO RFC EDITOR: Please replace above reference to
draft-ietf-i2rs-yang-network-topo-02 with RFC
number when published (i.e. RFC xxxx).";
revision 2015-12-08 {
description
"Initial revision.
NOTE TO RFC EDITOR: Please replace the following reference
to draft-ietf-i2rs-yang-network-topo-02 with
RFC number when published (i.e. RFC xxxx).";
reference
"draft-ietf-i2rs-yang-network-topo-02";
}
notification network-up {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
notification network-down {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
}
module ietf-network2 {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network2";
prefix nd;
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
WG Chair: Susan Hares
<mailto:shares@ndzh.com>
WG Chair: Jeffrey Haas
<mailto:jhaas@pfrc.org>
Editor: Alexander Clemm
<mailto:alex@cisco.com>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:rovarga@cisco.com>
Editor: Tony Tkacik
<mailto:ttkacik@cisco.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a common base model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2015 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of
draft-ietf-i2rs-yang-network-topo-02;
see the RFC itself for full legal notices.
NOTE TO RFC EDITOR: Please replace above reference to
draft-ietf-i2rs-yang-network-topo-02 with RFC
number when published (i.e. RFC xxxx).";
revision 2015-12-08 {
description
"Initial revision.
NOTE TO RFC EDITOR: Please replace the following reference
to draft-ietf-i2rs-yang-network-topo-02 with
RFC number when published (i.e. RFC xxxx).";
reference
"draft-ietf-i2rs-yang-network-topo-02";
}
notification network-up {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
notification network-down {
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}
}
module ietf-network3 {
yang-version 1;
namespace "urn:ietf:params:xml:ns:yang:ietf-network3";
prefix nd;
organization
"IETF I2RS (Interface to the Routing System) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/i2rs/>
WG List: <mailto:i2rs@ietf.org>
WG Chair: Susan Hares
<mailto:shares@ndzh.com>
WG Chair: Jeffrey Haas
<mailto:jhaas@pfrc.org>
Editor: Alexander Clemm
<mailto:alex@cisco.com>
Editor: Jan Medved
<mailto:jmedved@cisco.com>
Editor: Robert Varga
<mailto:rovarga@cisco.com>
Editor: Tony Tkacik
<mailto:ttkacik@cisco.com>
Editor: Nitin Bahadur
<mailto:nitin_bahadur@yahoo.com>
Editor: Hariharan Ananthakrishnan
<mailto:hari@packetdesign.com>";
description
"This module defines a common base model for a collection
of nodes in a network. Node definitions are further used
in network topologies and inventories.
Copyright (c) 2015 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License
set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of
draft-ietf-i2rs-yang-network-topo-02;
see the RFC itself for full legal notices.
NOTE TO RFC EDITOR: Please replace above reference to
draft-ietf-i2rs-yang-network-topo-02 with RFC
number when published (i.e. RFC xxxx).";
revision 2015-12-08 {
description
"Initial revision.
NOTE TO RFC EDITOR: Please replace the following reference
to draft-ietf-i2rs-yang-network-topo-02 with
RFC number when published (i.e. RFC xxxx).";
reference
"draft-ietf-i2rs-yang-network-topo-02";
}
container networks {
leaf id {
type int32;
}
container network {
leaf ip-address {
type int32;
}
}
}
}