[ONOS-3801] Implements L3 REST call json parser
- Nullability check for RouterCodec, RoutingInterfaceCodec, RoutingWebResource.
- Copyright fixed.
- externalFixedIps() method in OpenstackExternalGateway class returns the immutable Map.
Change-Id: I841cc1774a074e167ffe327c6e81d3f245cc8ee0
diff --git a/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackPortInfo.java b/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackPortInfo.java
new file mode 100644
index 0000000..45b6f59
--- /dev/null
+++ b/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackPortInfo.java
@@ -0,0 +1,108 @@
+/*
+ * 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.openstackswitching;
+
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.MacAddress;
+import org.onosproject.net.DeviceId;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Contains OpenstackPort Information.
+ */
+public class OpenstackPortInfo {
+ private final Ip4Address hostIp;
+ private final MacAddress hostMac;
+ private final DeviceId deviceId;
+ private final long vni;
+ private final Ip4Address gatewayIP;
+
+ public OpenstackPortInfo(Ip4Address hostIp, MacAddress hostMac, DeviceId deviceId, long vni, Ip4Address gatewayIP) {
+ this.hostIp = hostIp;
+ this.hostMac = hostMac;
+ this.deviceId = deviceId;
+ this.vni = vni;
+ this.gatewayIP = gatewayIP;
+ }
+
+ public Ip4Address ip() {
+ return hostIp;
+ }
+
+ public MacAddress mac() {
+ return hostMac;
+ }
+
+ public DeviceId deviceId() {
+ return deviceId;
+ }
+
+ public long vni() {
+ return vni;
+ }
+
+ public Ip4Address gatewayIP() {
+ return gatewayIP;
+ }
+
+ public static OpenstackPortInfo.Builder builder() {
+ return new Builder();
+ }
+
+ public static final class Builder {
+ private Ip4Address hostIp;
+ private MacAddress hostMac;
+ private DeviceId deviceId;
+ private long vni;
+ private Ip4Address gatewayIP;
+
+ public Builder setGatewayIP(Ip4Address gatewayIP) {
+ this.gatewayIP = checkNotNull(gatewayIP, "gatewayIP cannot be null");
+ return this;
+ }
+
+ public Builder setHostIp(Ip4Address hostIp) {
+ this.hostIp = checkNotNull(hostIp, "hostIp cannot be null");
+ return this;
+ }
+
+ public Builder setHostMac(MacAddress hostMac) {
+ this.hostMac = checkNotNull(hostMac, "hostMac cannot be bull");
+ return this;
+ }
+
+ public Builder setDeviceId(DeviceId deviceId) {
+ this.deviceId = checkNotNull(deviceId, "deviceId cannot be null");
+ return this;
+ }
+
+ public Builder setVni(long vni) {
+ this.vni = checkNotNull(vni, "vni cannot be null");
+ return this;
+ }
+ public OpenstackPortInfo build() {
+ return new OpenstackPortInfo(this);
+ }
+ }
+
+ private OpenstackPortInfo(Builder builder) {
+ hostIp = builder.hostIp;
+ hostMac = builder.hostMac;
+ deviceId = builder.deviceId;
+ vni = builder.vni;
+ gatewayIP = builder.gatewayIP;
+ }
+}
diff --git a/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackSwitchingService.java b/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackSwitchingService.java
index 8960dcd..f81ddae 100644
--- a/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackSwitchingService.java
+++ b/apps/openstackswitching/api/src/main/java/org/onosproject/openstackswitching/OpenstackSwitchingService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Open Networking Laboratory
+ * Copyright 2015-2016 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.
@@ -16,6 +16,8 @@
package org.onosproject.openstackswitching;
import org.onosproject.net.Port;
+import org.onosproject.openstackrouting.OpenstackRouter;
+import org.onosproject.openstackrouting.OpenstackRouterInterface;
import java.util.Collection;
@@ -68,6 +70,12 @@
Collection<OpenstackPort> ports(String networkId);
/**
+ * Returns port information list.
+ *
+ * @return port information list
+ */
+ Collection<OpenstackPort> ports();
+ /**
* Returns port information for the port given.
*
* @param port port reference
@@ -99,4 +107,68 @@
* @return subnet information, or null if not present
*/
OpenstackSubnet subnet(String subnetId);
+
+ /**
+ * Sends the created router information to OpenstackRouting service.
+ *
+ * @param openstackRouter Router Information
+ */
+ void createRouter(OpenstackRouter openstackRouter);
+ /**
+ * Sends the updated router information to OpenstackRouting service.
+ *
+ * @param routerId Router ID
+ */
+ void updateRouter(String routerId);
+ /**
+ * Sends the removed router information to OpenstackRouting service.
+ *
+ * @param routerId Router ID
+ */
+ void deleteRouter(String routerId);
+
+ /**
+ * Sends the updated router interface information to OpenstackRouting service.
+ *
+ * @param openstackRouterInterface Router interface information
+ */
+ void updateRouterInterface(OpenstackRouterInterface openstackRouterInterface);
+
+ /**
+ * Sends the removed router interface information to OpenstackRouting service.
+ *
+ * @param openstackRouterInterface Router interface information
+ */
+ void removeRouterInterface(OpenstackRouterInterface openstackRouterInterface);
+
+ /**
+ * Returns the router information list.
+ *
+ * @return router information list
+ */
+ Collection<OpenstackRouter> routers();
+
+ /**
+ * Returns the router information for the router ID given.
+ *
+ * @param routerId router ID
+ * @return router information
+ */
+ OpenstackRouter router(String routerId);
+
+ /**
+ * Returns the OpensatckPortInfo list.
+ *
+ * @return OpensatckPortInfo list
+ */
+ Collection<OpenstackPortInfo> portInfos();
+
+ /**
+ * Returns the MacAddress for physical router.
+ *
+ * @return physical router mac
+ */
+ String physicalRouterMac();
+
+
}