Andrea Campanella
Committed by Gerrit Code Review

ONOS-3743 Adding end pattern to doRPC, removing unused rfc module and minor refa…

…ctoring of provider methods

Change-Id: I95f896b80705ffb176534f2d4ba58acc786713e3
......@@ -126,7 +126,7 @@ public class NetconfSessionImpl implements NetconfSession {
@Override
public String doRPC(String request) throws IOException {
String reply = doRequest(request);
String reply = doRequest(request + "\n" + endpattern);
return checkReply(reply) ? reply : "ERROR " + reply;
}
......
......@@ -30,7 +30,6 @@
<modules>
<module>api</module>
<module>rfc</module>
<module>ctl</module>
</modules>
......
<?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>
package org.onosproject.netconf.rfc;
/**
* Created by tom on 10/19/15.
*/
public class Foo {
}
/*
* 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;
......@@ -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>
......
......@@ -49,7 +49,6 @@ import org.onosproject.netconf.NetconfDeviceListener;
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 @@ public class NetconfDeviceProvider extends AbstractProvider
@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 @@ public class NetconfDeviceProvider extends AbstractProvider
cfgService.registerConfigFactory(factory);
cfgService.addListener(cfgLister);
controller.addDeviceListener(innerNodeListener);
connectExistingDevices();
appId = coreService.registerApplication("org.onosproject.netconf");
connectDevices();
log.info("Started");
}
......@@ -132,14 +130,7 @@ public class NetconfDeviceProvider extends AbstractProvider
@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 @@ public class NetconfDeviceProvider extends AbstractProvider
}
}
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) {
......