Moved ProxyArp, SDN-IP and BgpRouter to use new config format.
The new config format is based on the new network configuration subsystem.
Includes a few config fixes to NetworkConfigLoader and InterfaceManager.
Change-Id: Id7f766736decb7afb6b63c2731d3baba9fc7c764
diff --git a/apps/routing-api/src/main/java/org/onosproject/routing/RoutingService.java b/apps/routing-api/src/main/java/org/onosproject/routing/RoutingService.java
index 5706211..8b7040e 100644
--- a/apps/routing-api/src/main/java/org/onosproject/routing/RoutingService.java
+++ b/apps/routing-api/src/main/java/org/onosproject/routing/RoutingService.java
@@ -18,6 +18,7 @@
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onosproject.net.ConnectPoint;
+import org.onosproject.routing.config.BgpConfig;
import java.util.Collection;
@@ -28,6 +29,8 @@
String ROUTER_APP_ID = "org.onosproject.router";
+ Class<BgpConfig> CONFIG_CLASS = BgpConfig.class;
+
/**
* Specifies the type of an IP address or an IP prefix location.
*/
diff --git a/apps/routing-api/src/main/java/org/onosproject/routing/config/BgpConfig.java b/apps/routing-api/src/main/java/org/onosproject/routing/config/BgpConfig.java
new file mode 100644
index 0000000..54e2e0e
--- /dev/null
+++ b/apps/routing-api/src/main/java/org/onosproject/routing/config/BgpConfig.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+package org.onosproject.routing.config;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Sets;
+import org.onlab.packet.IpAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.config.Config;
+import org.onosproject.net.ConnectPoint;
+
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Configuration object for BGP config.
+ */
+public class BgpConfig extends Config<ApplicationId> {
+
+ public static final String SPEAKERS = "bgpSpeakers";
+ public static final String CONNECT_POINT = "connectPoint";
+ public static final String PEERS = "peers";
+
+ // TODO add methods for updating config
+
+ /**
+ * Gets the set of configured BGP speakers.
+ *
+ * @return BGP speakers
+ */
+ public Set<BgpSpeakerConfig> bgpSpeakers() {
+ Set<BgpSpeakerConfig> speakers = Sets.newHashSet();
+
+ JsonNode speakersNode = node.get(SPEAKERS);
+ speakersNode.forEach(jsonNode -> {
+ Set<IpAddress> listenAddresses = Sets.newHashSet();
+ jsonNode.path(PEERS).forEach(addressNode ->
+ listenAddresses.add(IpAddress.valueOf(addressNode.asText()))
+ );
+ speakers.add(new BgpSpeakerConfig(
+ ConnectPoint.deviceConnectPoint(jsonNode.path(CONNECT_POINT).asText()),
+ listenAddresses));
+ });
+
+ return speakers;
+ }
+
+ /**
+ * Configuration for a BGP speaker.
+ */
+ public static class BgpSpeakerConfig {
+
+ private ConnectPoint connectPoint;
+ private Set<IpAddress> peers;
+
+ public BgpSpeakerConfig(ConnectPoint connectPoint, Set<IpAddress> peers) {
+ this.connectPoint = checkNotNull(connectPoint);
+ this.peers = checkNotNull(peers);
+ }
+
+ public ConnectPoint connectPoint() {
+ return connectPoint;
+ }
+
+ public Set<IpAddress> peers() {
+ return peers;
+ }
+ }
+}
diff --git a/apps/routing-api/src/main/java/org/onosproject/routing/config/RoutingConfigurationService.java b/apps/routing-api/src/main/java/org/onosproject/routing/config/RoutingConfigurationService.java
index bbd9560..f8ee21b 100644
--- a/apps/routing-api/src/main/java/org/onosproject/routing/config/RoutingConfigurationService.java
+++ b/apps/routing-api/src/main/java/org/onosproject/routing/config/RoutingConfigurationService.java
@@ -77,7 +77,9 @@
* Retrieves the entire set of interfaces in the network.
*
* @return the set of interfaces
+ * @deprecated in Drake release - use InterfaceService instead
*/
+ @Deprecated
Set<Interface> getInterfaces();
/**
@@ -86,7 +88,7 @@
*
* @return the set of connect points connected to BGP peers
*/
- public Set<ConnectPoint> getBgpPeerConnectPoints();
+ Set<ConnectPoint> getBgpPeerConnectPoints();
/**
* Retrieves the interface associated with the given connect point.
@@ -94,7 +96,9 @@
* @param connectPoint the connect point to retrieve interface information
* for
* @return the interface
+ * @deprecated in Drake release - use InterfaceService instead
*/
+ @Deprecated
Interface getInterface(ConnectPoint connectPoint);
/**
@@ -102,7 +106,9 @@
*
* @param ip IP address of the interface
* @return the interface
+ * @deprecated in Drake release - use InterfaceService instead
*/
+ @Deprecated
Interface getInterface(IpAddress ip);
/**
@@ -111,7 +117,9 @@
*
* @param ipAddress IP address to match
* @return the matching interface
+ * @deprecated in Drake release - use InterfaceService instead
*/
+ @Deprecated
Interface getMatchingInterface(IpAddress ipAddress);
}