ONOS-3743 Adding end pattern to doRPC, removing unused rfc module and minor refactoring of provider methods
Change-Id: I95f896b80705ffb176534f2d4ba58acc786713e3
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
index ab7c746..795211e 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/NetconfSessionImpl.java
@@ -126,7 +126,7 @@
@Override
public String doRPC(String request) throws IOException {
- String reply = doRequest(request);
+ String reply = doRequest(request + "\n" + endpattern);
return checkReply(reply) ? reply : "ERROR " + reply;
}
diff --git a/protocols/netconf/pom.xml b/protocols/netconf/pom.xml
index 7795a12..19b79c3 100644
--- a/protocols/netconf/pom.xml
+++ b/protocols/netconf/pom.xml
@@ -30,7 +30,6 @@
<modules>
<module>api</module>
- <module>rfc</module>
<module>ctl</module>
</modules>
diff --git a/protocols/netconf/rfc/pom.xml b/protocols/netconf/rfc/pom.xml
deleted file mode 100644
index 7054028..0000000
--- a/protocols/netconf/rfc/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2015 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.
- -->
-<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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-netconf</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-netconf-rfc</artifactId>
- <packaging>bundle</packaging>
-
-</project>
diff --git a/protocols/netconf/rfc/src/main/java/org/onosproject/netconf/rfc/Foo.java b/protocols/netconf/rfc/src/main/java/org/onosproject/netconf/rfc/Foo.java
deleted file mode 100644
index 06963b0..0000000
--- a/protocols/netconf/rfc/src/main/java/org/onosproject/netconf/rfc/Foo.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.onosproject.netconf.rfc;
-
-/**
- * Created by tom on 10/19/15.
- */
-public class Foo {
-}
diff --git a/protocols/netconf/rfc/src/main/java/org/onosproject/netconf/rfc/package-info.java b/protocols/netconf/rfc/src/main/java/org/onosproject/netconf/rfc/package-info.java
deleted file mode 100644
index 2adc767..0000000
--- a/protocols/netconf/rfc/src/main/java/org/onosproject/netconf/rfc/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2015 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.
- */
-
-/**
- * NETCONF libraries.
- */
-package org.onosproject.netconf.rfc;
diff --git a/providers/netconf/app/app.xml b/providers/netconf/app/app.xml
index d920d24..288f0ab 100644
--- a/providers/netconf/app/app.xml
+++ b/providers/netconf/app/app.xml
@@ -19,7 +19,6 @@
features="${project.artifactId}">
<description>${project.description}</description>
- <artifact>mvn:${project.groupId}/onos-netconf-rfc/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-netconf-api/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-netconf-ctl/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-drivers/${project.version}</artifact>
diff --git a/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java b/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
index 860b1f8..0aea67e 100644
--- a/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
+++ b/providers/netconf/device/src/main/java/org/onosproject/provider/netconf/device/impl/NetconfDeviceProvider.java
@@ -49,7 +49,6 @@
import org.slf4j.Logger;
import java.io.IOException;
-import java.util.Map;
import static org.onosproject.net.config.basics.SubjectFactories.APP_SUBJECT_FACTORY;
import static org.slf4j.LoggerFactory.getLogger;
@@ -65,8 +64,6 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DeviceProviderRegistry providerRegistry;
- // @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-// protected DeviceService deviceService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected NetconfController controller; //where is initiated ?
@@ -102,7 +99,8 @@
cfgService.registerConfigFactory(factory);
cfgService.addListener(cfgLister);
controller.addDeviceListener(innerNodeListener);
- connectExistingDevices();
+ appId = coreService.registerApplication("org.onosproject.netconf");
+ connectDevices();
log.info("Started");
}
@@ -132,14 +130,7 @@
@Override
public boolean isReachable(DeviceId deviceId) {
- Map<DeviceId, NetconfDevice> devices = controller.getDevicesMap();
-
- NetconfDevice netconfDevice = null;
- for (DeviceId key : devices.keySet()) {
- if (key.equals(deviceId)) {
- netconfDevice = controller.getDevicesMap().get(key);
- }
- }
+ NetconfDevice netconfDevice = controller.getNetconfDevice(deviceId);
if (netconfDevice == null) {
log.warn("BAD REQUEST: the requested device id: "
+ deviceId.toString()
@@ -180,12 +171,6 @@
}
}
- private void connectExistingDevices() {
- //TODO consolidate
- appId = coreService.registerApplication("org.onosproject.netconf");
- connectDevices();
- }
-
private void connectDevices() {
NetconfProviderConfig cfg = cfgService.getConfig(appId, NetconfProviderConfig.class);
if (cfg != null) {