mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 02:11:38 +02:00
Refactoring NETCONF client to consolidate active and passive components into the same jar and app.
Simplifying names and consolidating dependencies on other apps. Change-Id: Ifd7f9253732839a083930ebc5f04116daf090e06
This commit is contained in:
parent
0cb73f4c66
commit
59d24eb00b
27
apps/netconf/client/BUCK
Normal file
27
apps/netconf/client/BUCK
Normal file
@ -0,0 +1,27 @@
|
||||
APPS = [
|
||||
'org.onosproject.yang',
|
||||
'org.onosproject.config',
|
||||
'org.onosproject.netconf',
|
||||
]
|
||||
|
||||
COMPILE_DEPS = [
|
||||
'//lib:CORE_DEPS',
|
||||
'//lib:onos-yang-model',
|
||||
'//lib:onos-yang-runtime',
|
||||
'//apps/config:onos-apps-config',
|
||||
'//protocols/netconf/api:onos-protocols-netconf-api',
|
||||
'//utils/osgi:onlab-osgi',
|
||||
]
|
||||
|
||||
osgi_jar_with_tests(
|
||||
deps = COMPILE_DEPS,
|
||||
)
|
||||
|
||||
onos_app(
|
||||
app_name = 'org.onosproject.netconfsb',
|
||||
title = 'NETCONF Device Configuration',
|
||||
category = 'Protocols',
|
||||
url = 'http://onosproject.org',
|
||||
description = 'Extension to allow ONOS to configure NETCONF devices.',
|
||||
required_apps = APPS,
|
||||
)
|
@ -14,12 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.onosproject.netconf.storeadapter;
|
||||
package org.onosproject.netconf.client.impl;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
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;
|
||||
@ -29,13 +28,10 @@ import org.onosproject.config.DynamicConfigService;
|
||||
import org.onosproject.config.Filter;
|
||||
import org.onosproject.mastership.MastershipService;
|
||||
import org.onosproject.net.DeviceId;
|
||||
import org.onosproject.net.resource.Resource;
|
||||
import org.onosproject.netconf.NetconfController;
|
||||
import org.onosproject.netconf.NetconfException;
|
||||
import org.onosproject.netconf.client.NetconfTranslator;
|
||||
import org.onosproject.netconf.client.NetconfTranslator.OperationType;
|
||||
import org.onosproject.netconf.NetconfException;
|
||||
import org.onosproject.netconf.NetconfController;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import org.onosproject.yang.model.DataNode;
|
||||
import org.onosproject.yang.model.LeafNode;
|
||||
import org.onosproject.yang.model.ResourceId;
|
||||
@ -44,6 +40,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
|
||||
@Beta
|
||||
@ -65,8 +63,9 @@ public class NetconfActiveComponent implements DynamicConfigListener {
|
||||
protected NetconfController controller;
|
||||
|
||||
private ResourceId resId = new ResourceId.Builder()
|
||||
.addBranchPointSchema("device", DEVNMSPACE )
|
||||
.addBranchPointSchema("device", DEVNMSPACE)
|
||||
.build();
|
||||
|
||||
@Activate
|
||||
protected void activate() {
|
||||
cfgService.addListener(this);
|
||||
@ -81,19 +80,11 @@ public class NetconfActiveComponent implements DynamicConfigListener {
|
||||
|
||||
@Override
|
||||
public boolean isRelevant(DynamicConfigEvent event) {
|
||||
if (event.subject().equals(resId)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return event.subject().equals(resId);
|
||||
}
|
||||
|
||||
public boolean isMaster(DeviceId deviceId) {
|
||||
if (mastershipService.isLocalMaster(deviceId)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return mastershipService.isLocalMaster(deviceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,8 +115,9 @@ public class NetconfActiveComponent implements DynamicConfigListener {
|
||||
|
||||
/**
|
||||
* Performs the delete operation corresponding to the passed event.
|
||||
* @param node a relevant dataNode
|
||||
* @param deviceId the deviceId of the device to be updated
|
||||
*
|
||||
* @param node a relevant dataNode
|
||||
* @param deviceId the deviceId of the device to be updated
|
||||
* @param resourceId the resourceId of the root of the subtree to be edited
|
||||
* @return true if the update succeeds false otherwise
|
||||
*/
|
||||
@ -135,8 +127,9 @@ public class NetconfActiveComponent implements DynamicConfigListener {
|
||||
|
||||
/**
|
||||
* Performs the update operation corresponding to the passed event.
|
||||
* @param node a relevant dataNode
|
||||
* @param deviceId the deviceId of the device to be updated
|
||||
*
|
||||
* @param node a relevant dataNode
|
||||
* @param deviceId the deviceId of the device to be updated
|
||||
* @param resourceId the resourceId of the root of the subtree to be edited
|
||||
* @return true if the update succeeds false otherwise
|
||||
*/
|
||||
@ -147,10 +140,11 @@ public class NetconfActiveComponent implements DynamicConfigListener {
|
||||
/**
|
||||
* Parses the incoming event and pushes configuration to the effected
|
||||
* device.
|
||||
* @param node the dataNode effecting a particular device of which this node
|
||||
* is master
|
||||
* @param deviceId the deviceId of the device to be modified
|
||||
* @param resourceId the resourceId of the root of the subtree to be edited
|
||||
*
|
||||
* @param node the dataNode effecting a particular device of which this node
|
||||
* is master
|
||||
* @param deviceId the deviceId of the device to be modified
|
||||
* @param resourceId the resourceId of the root of the subtree to be edited
|
||||
* @param operationType the type of editing to be performed
|
||||
* @return true if the operation succeeds, false otherwise
|
||||
*/
|
||||
@ -206,11 +200,11 @@ public class NetconfActiveComponent implements DynamicConfigListener {
|
||||
if (controller.getNetconfDevice(deviceId) == null) {
|
||||
try {
|
||||
//if (this.isReachable(deviceId)) {
|
||||
this.controller.connectDevice(deviceId);
|
||||
this.controller.connectDevice(deviceId);
|
||||
//}
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException(new NetconfException("Can\'t " +
|
||||
"connect to NETCONF device on " + deviceId + ":" + deviceId, ex));
|
||||
throw new RuntimeException(new NetconfException("Unable to connect to NETCONF device on " +
|
||||
deviceId, ex));
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
|
||||
package org.onosproject.netconf.client.impl;
|
||||
|
||||
import org.apache.felix.scr.annotations.Service;
|
||||
import org.onosproject.cluster.NodeId;
|
||||
import org.onosproject.net.DeviceId;
|
||||
import org.onosproject.netconf.client.NetconfTranslator;
|
||||
@ -89,6 +90,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
* will be no session available.
|
||||
*/
|
||||
@Beta
|
||||
@Service
|
||||
@Component(immediate = true)
|
||||
public class NetconfTranslatorImpl implements NetconfTranslator {
|
||||
|
@ -1,15 +0,0 @@
|
||||
BUNDLES = [
|
||||
'//apps/netconfsb/client:onos-apps-netconfsb-client',
|
||||
'//apps/netconfsb/storeadapter:onos-apps-netconfsb-storeadapter',
|
||||
]
|
||||
|
||||
onos_app (
|
||||
app_name = 'org.onosproject.netconfsb',
|
||||
title = 'NETCONF Application Module',
|
||||
category = 'Utility',
|
||||
url = 'http://onosproject.org',
|
||||
description = """This application provides an interface for monitoring and modifying datastores
|
||||
of NETCONF devices using Yang data. It uses the YangRuntime to serialize outbound
|
||||
messages from Yang into NETCONF and deserialize received messages.""",
|
||||
included_bundles = BUNDLES,
|
||||
)
|
@ -1,23 +0,0 @@
|
||||
APPS = [
|
||||
'org.onosproject.yang',
|
||||
]
|
||||
|
||||
COMPILE_DEPS = [
|
||||
'//lib:CORE_DEPS',
|
||||
'//lib:onos-yang-model',
|
||||
'//lib:onos-yang-runtime',
|
||||
'//protocols/netconf/api:onos-protocols-netconf-api',
|
||||
'//utils/osgi:onlab-osgi',
|
||||
]
|
||||
|
||||
osgi_jar_with_tests (
|
||||
deps = COMPILE_DEPS,
|
||||
)
|
||||
|
||||
onos_app (
|
||||
title = 'Dynamic Config Netconf App',
|
||||
category = 'Utility',
|
||||
url = 'http://onosproject.org',
|
||||
description = 'Netconf support for Dynamic configuration service.',
|
||||
required_apps = APPS,
|
||||
)
|
@ -1,30 +0,0 @@
|
||||
COMPILE_DEPS = [
|
||||
'//lib:CORE_DEPS',
|
||||
'//lib:onos-yang-model',
|
||||
'//lib:onos-yang-runtime',
|
||||
'//apps/config:onos-apps-config',
|
||||
'//protocols/netconf/api:onos-protocols-netconf-api',
|
||||
'//apps/netconfsb/client:onos-apps-netconfsb-client'
|
||||
|
||||
|
||||
]
|
||||
|
||||
osgi_jar_with_tests (
|
||||
deps = COMPILE_DEPS,
|
||||
)
|
||||
|
||||
BUNDLES = [
|
||||
'//apps/netconfsb/client:onos-apps-netconfsb-client',
|
||||
'//apps/netconfsb/storeadapter:onos-apps-netconfsb-storeadapter',
|
||||
]
|
||||
|
||||
onos_app (
|
||||
app_name = 'org.onosproject.netconfsb',
|
||||
title = 'NETCONF Application Module',
|
||||
category = 'Utility',
|
||||
url = 'http://onosproject.org',
|
||||
description = """This application provides an interface for monitoring and modifying datastores
|
||||
of NETCONF devices using Yang data. It uses the YangRuntime to serialize outbound
|
||||
messages from Yang into NETCONF and deserialize received messages.""",
|
||||
included_bundles = BUNDLES,
|
||||
)
|
@ -178,7 +178,7 @@ ONOS_APPS = [
|
||||
'//apps/ofagent:onos-apps-ofagent-oar',
|
||||
'//apps/mappingmanagement:onos-apps-mappingmanagement-oar',
|
||||
'//apps/config:onos-apps-config-oar',
|
||||
'//apps/netconfsb:onos-apps-netconfsb-oar',
|
||||
'//apps/netconf/client:onos-apps-netconf-client-oar',
|
||||
'//apps/tetopology:onos-apps-tetopology-oar',
|
||||
'//apps/tetunnel:onos-apps-tetunnel-oar',
|
||||
# '//apps/tenbi/yangmodel:onos-apps-tenbi-yangmodel-feature',
|
||||
@ -210,3 +210,4 @@ APP_JARS = [
|
||||
]
|
||||
|
||||
APPS = ONOS_DRIVERS + ONOS_PROVIDERS + ONOS_APPS
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user