OpenstackRouting refactoring
- Replace OpenstackPortInfo with HostService
- Replace OpenstackRoutingConfig with OpenstackNodeService
(Remove OpenstackRoutingConfig)
- Rebased with 10330 (existing_vm)
- Added initialization process using OpenstackNodeListener
Change-Id: If2ce8eb86d242a7180c9154e1a0f1668b266bf1c
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/Constants.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/Constants.java
new file mode 100644
index 0000000..54334b9
--- /dev/null
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/Constants.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016-present 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.openstacknetworking;
+
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip4Prefix;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+
+/**
+ * Provides constants used in OpenStackSwitching.
+ */
+public final class Constants {
+
+ private Constants() {
+ }
+
+ public static final String APP_ID = "org.onosproject.openstackswitching";
+
+ public static final String PORTNAME_PREFIX_VM = "tap";
+ public static final String PORTNAME_PREFIX_ROUTER = "qr-";
+ public static final String PORTNAME_PREFIX_TUNNEL = "vxlan";
+
+ public static final MacAddress GATEWAY_MAC = MacAddress.valueOf("1f:1f:1f:1f:1f:1f");
+
+ // TODO: Please change these valuses following the way vrouter is implemented
+ public static final MacAddress GW_EXT_INT_MAC = MacAddress.valueOf("56:e6:30:a6:8c:e5");
+ public static final MacAddress PHY_ROUTER_MAC = MacAddress.valueOf("00:00:00:00:01:01");
+
+ public static final Ip4Address DNS_SERVER_IP = Ip4Address.valueOf("8.8.8.8");
+ public static final IpPrefix IP_PREFIX_ANY = Ip4Prefix.valueOf("0.0.0.0/0");
+ public static final int DHCP_INFINITE_LEASE = -1;
+
+ public static final String NETWORK_ID = "networkId";
+ public static final String PORT_ID = "portId";
+ public static final String VXLAN_ID = "vxlanId";
+ public static final String TENANT_ID = "tenantId";
+ public static final String GATEWAY_IP = "gatewayIp";
+ public static final String CREATE_TIME = "createTime";
+
+ public static final int SWITCHING_RULE_PRIORITY = 30000;
+ public static final int TUNNELTAG_RULE_PRIORITY = 30000;
+ public static final int ACL_RULE_PRIORITY = 30000;
+
+}
\ No newline at end of file
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPortInfo.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPortInfo.java
deleted file mode 100644
index b40b865..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPortInfo.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright 2016-present 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.openstacknetworking;
-
-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.
- */
-// TODO remove this
-public final class OpenstackPortInfo {
- private final Ip4Address hostIp;
- private final MacAddress hostMac;
- private final DeviceId deviceId;
- private final long vni;
- private final Ip4Address gatewayIP;
- private final String networkId;
-
- /**
- * Returns OpenstackPortInfo reference.
- *
- * @param hostIp host IP address
- * @param hostMac host MAC address
- * @param deviceId device ID
- * @param vni tunnel ID
- * @param gatewayIP gateway IP address
- * @param networkId network identifier
- */
- public OpenstackPortInfo(Ip4Address hostIp, MacAddress hostMac, DeviceId deviceId, long vni,
- Ip4Address gatewayIP, String networkId) {
- this.hostIp = hostIp;
- this.hostMac = hostMac;
- this.deviceId = deviceId;
- this.vni = vni;
- this.gatewayIP = gatewayIP;
- this.networkId = networkId;
- }
-
- /**
- * Returns IP address of the port.
- *
- * @return IP address
- */
- public Ip4Address ip() {
- return hostIp;
- }
-
- /**
- * Returns MAC address of the port.
- *
- * @return MAC address
- */
- public MacAddress mac() {
- return hostMac;
- }
-
- /**
- * Returns device ID.
- *
- * @return device ID
- */
- public DeviceId deviceId() {
- return deviceId;
- }
-
- /**
- * Returns tunnel ID.
- *
- * @return tunnel ID
- */
- public long vni() {
- return vni;
- }
-
- /**
- * Returns gateway IP address.
- *
- * @return gateway IP address
- */
- public Ip4Address gatewayIP() {
- return gatewayIP;
- }
-
- /**
- * Returns network ID.
- *
- * @return network ID
- */
- public String networkId() {
- return networkId;
- }
-
- /**
- * Returns the builder of the OpenstackPortInfo.
- *
- * @return OpenstackPortInfo builder reference
- */
- public static OpenstackPortInfo.Builder builder() {
- return new Builder();
- }
-
- /**
- * Represents the OpenstackPortInfo Builder.
- *
- */
- public static final class Builder {
- private Ip4Address hostIp;
- private MacAddress hostMac;
- private DeviceId deviceId;
- private long vni;
- private Ip4Address gatewayIP;
- private String networkId;
-
- /**
- * Sets the IP address of the port.
- *
- * @param gatewayIP gateway IP
- * @return Builder reference
- */
- public Builder setGatewayIP(Ip4Address gatewayIP) {
- this.gatewayIP = checkNotNull(gatewayIP, "gatewayIP cannot be null");
- return this;
- }
-
- /**
- * Sets the network ID.
- *
- * @param networkId network id
- * @return Builder reference
- */
- public Builder setNetworkId(String networkId) {
- this.networkId = checkNotNull(networkId, "networkId cannot be null");
- return this;
- }
-
- /**
- * Sets the host IP address of the port.
- *
- * @param hostIp host IP address
- * @return Builder reference
- */
- public Builder setHostIp(Ip4Address hostIp) {
- this.hostIp = checkNotNull(hostIp, "hostIp cannot be null");
- return this;
- }
-
- /**
- * Sets the host MAC address of the port.
- *
- * @param hostMac host MAC address
- * @return Builder reference
- */
- public Builder setHostMac(MacAddress hostMac) {
- this.hostMac = checkNotNull(hostMac, "hostMac cannot be bull");
- return this;
- }
-
- /**
- * Sets the device ID.
- *
- * @param deviceId device ID
- * @return Builder reference
- */
- public Builder setDeviceId(DeviceId deviceId) {
- this.deviceId = checkNotNull(deviceId, "deviceId cannot be null");
- return this;
- }
-
- /**
- * Sets the tunnel ID.
- *
- * @param vni tunnel ID
- * @return Builder reference
- */
- public Builder setVni(long vni) {
- this.vni = checkNotNull(vni, "vni cannot be null");
- return this;
- }
-
- /**
- * Builds the OpenstackPortInfo reference.
- *
- * @return OpenstackPortInfo reference
- */
- public OpenstackPortInfo build() {
- return new OpenstackPortInfo(hostIp, hostMac, deviceId, vni, gatewayIP, networkId);
- }
- }
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRoutingService.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRoutingService.java
index 7fe75b4..6b04bfe 100644
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRoutingService.java
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRoutingService.java
@@ -85,8 +85,8 @@
*
* @param portId Deleted vm
* @param portInfo stored information about deleted vm
- */
void checkDisassociatedFloatingIp(String portId, OpenstackPortInfo portInfo);
+ */
/**
* Returns network id for routerInterface.
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSwitchingService.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSwitchingService.java
deleted file mode 100644
index c9f32ab..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSwitchingService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2016-present 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.openstacknetworking;
-
-import java.util.Map;
-
-/**
- * Handles port management REST API from Openstack for VMs.
- */
-// TODO remove this
-public interface OpenstackSwitchingService {
-
- /**
- * Retruns OpenstackPortInfo map.
- *
- * @return OpenstackPortInfo map
- */
- // TODO remove this
- Map<String, OpenstackPortInfo> openstackPortInfo();
-}