ONOS-5182 Refactored SONA to cache network states
Change-Id: Ib316fa5fa5d36e9da370a1578ac55de4a8dd9b04
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/Constants.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/Constants.java
index 4ba121a..00e91b0 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/Constants.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/Constants.java
@@ -15,9 +15,6 @@
*/
package org.onosproject.openstacknetworking.api;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.Ip4Prefix;
-import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
/**
@@ -28,42 +25,18 @@
private Constants() {
}
- public static final String SWITCHING_APP_ID = "org.onosproject.openstackswitching";
- public static final String ROUTING_APP_ID = "org.onosproject.openstackrouting";
-
- public static final String DEVICE_OWNER_ROUTER_INTERFACE = "network:router_interface";
- public static final String DEVICE_OWNER_ROUTER_GATEWAY = "network:router_gateway";
- public static final String DEVICE_OWNER_FLOATING_IP = "network:floatingip";
-
- public static final String PORT_NAME_PREFIX_VM = "tap";
- public static final String PORT_NAME_PREFIX_TUNNEL = "vxlan";
+ public static final String OPENSTACK_NETWORKING_APP_ID = "org.onosproject.openstacknetworking";
public static final String DEFAULT_GATEWAY_MAC_STR = "fe:00:00:00:00:02";
public static final MacAddress DEFAULT_GATEWAY_MAC = MacAddress.valueOf(DEFAULT_GATEWAY_MAC_STR);
- // TODO make this configurable
public static final MacAddress DEFAULT_EXTERNAL_ROUTER_MAC = MacAddress.valueOf("fe:00:00:00:00: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 SUBNET_ID = "subnetId";
- 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;
- public static final int EW_ROUTING_RULE_PRIORITY = 28000;
-
- public static final int GATEWAY_ICMP_PRIORITY = 43000;
- public static final int ROUTING_RULE_PRIORITY = 25000;
- public static final int FLOATING_RULE_FOR_TRAFFIC_FROM_VM_PRIORITY = 42000;
- public static final int FLOATING_RULE_PRIORITY = 41000;
- public static final int PNAT_RULE_PRIORITY = 26000;
- public static final int PNAT_TIMEOUT = 120;
+ public static final int PRIORITY_TUNNEL_TAG_RULE = 30000;
+ public static final int PRIORITY_FLOATING_INTERNAL = 42000;
+ public static final int PRIORITY_FLOATING_EXTERNAL = 41000;
+ public static final int PRIORITY_ICMP_RULE = 43000;
+ public static final int PRIORITY_INTERNAL_ROUTING_RULE = 28000;
+ public static final int PRIORITY_EXTERNAL_ROUTING_RULE = 25000;
+ public static final int PRIORITY_SNAT_RULE = 26000;
+ public static final int PRIORITY_SWITCHING_RULE = 30000;
}
\ No newline at end of file
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePort.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePort.java
new file mode 100644
index 0000000..97a112b
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePort.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.PortNumber;
+
+/**
+ * Representation of virtual instance port.
+ */
+public interface InstancePort {
+
+ /**
+ * Returns the OpenStack network ID of the instance port.
+ *
+ * @return openstack network id
+ */
+ String networkId();
+
+ /**
+ * Returns the OpenStack port ID of a given host.
+ *
+ * @return openstack port id
+ */
+ String portId();
+
+ /**
+ * Returns the MAC address of the instance port.
+ *
+ * @return mac address
+ */
+ MacAddress macAddress();
+
+ /**
+ * Returns the IP address of the instance port.
+ *
+ * @return ip address
+ */
+ IpAddress ipAddress();
+
+ /**
+ * Returns the device ID of the instance port.
+ *
+ * @return device id
+ */
+ DeviceId deviceId();
+
+ /**
+ * Returns the port number of the instance port.
+ *
+ * @return port number
+ */
+ PortNumber portNumber();
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortEvent.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortEvent.java
new file mode 100644
index 0000000..945772e
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortEvent.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.event.AbstractEvent;
+
+/**
+ * Describes virtual instance port event.
+ */
+public class InstancePortEvent extends AbstractEvent<InstancePortEvent.Type, InstancePort> {
+
+ public enum Type {
+
+ /**
+ * Signifies that a new instance port is detected.
+ */
+ OPENSTACK_INSTANCE_PORT_DETECTED,
+
+ /**
+ * Signifies that the instance port is updated.
+ */
+ OPENSTACK_INSTANCE_PORT_UPDATED,
+
+ /**
+ * Signifies that the instance port is disabled.
+ */
+ OPENSTACK_INSTANCE_PORT_VANISHED
+ }
+
+ /**
+ * Creates an event of a given type for the specified instance port.
+ *
+ * @param type instance port event type
+ * @param instPort instance port
+ */
+ public InstancePortEvent(Type type, InstancePort instPort) {
+ super(type, instPort);
+ }
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortListener.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortListener.java
new file mode 100644
index 0000000..708a9dd
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.event.EventListener;
+
+/**
+ * Listener for instance port event.
+ */
+public interface InstancePortListener extends EventListener<InstancePortEvent> {
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortService.java
new file mode 100644
index 0000000..91c8183
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/InstancePortService.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
+import org.onosproject.event.ListenerService;
+
+import java.util.Set;
+
+/**
+ * Service for interacting with the inventory of instance ports.
+ */
+public interface InstancePortService
+ extends ListenerService<InstancePortEvent, InstancePortListener> {
+
+ /**
+ * Returns instance port with the given MAC address.
+ *
+ * @param macAddress mac address
+ * @return instance port; null if not found
+ */
+ InstancePort instancePort(MacAddress macAddress);
+
+ /**
+ * Returns instance port with the given IP address in the given OpenStack network.
+ *
+ * @param ipAddress ip address
+ * @param osNetId openstack network id
+ * @return instance port; null if not found
+ */
+ InstancePort instancePort(IpAddress ipAddress, String osNetId);
+
+ /**
+ * Returns instance port with the given openstack port ID.
+ *
+ * @param osPortId openstack port id
+ * @return instance port; null if not found
+ */
+ InstancePort instancePort(String osPortId);
+
+ /**
+ * Returns all instance ports.
+ *
+ * @return set of instance ports; empty list if no port exists
+ */
+ Set<InstancePort> instancePorts();
+
+ /**
+ * Returns instance ports in the given OpenStack network.
+ *
+ * @param osNetId openstack network
+ * @return set of instance ports; empty list if no port exists
+ */
+ Set<InstancePort> instancePorts(String osNetId);
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackFloatingIpService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackFloatingIpService.java
deleted file mode 100644
index 9988a4e..0000000
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackFloatingIpService.java
+++ /dev/null
@@ -1,66 +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.api;
-
-import org.onosproject.net.Host;
-
-import org.onosproject.openstackinterface.OpenstackFloatingIP;
-
-/**
- * Handles floating IP update requests from OpenStack.
- */
-public interface OpenstackFloatingIpService {
-
- enum Action {
- ASSOCIATE,
- DISSASSOCIATE
- }
-
- /**
- * Handles floating IP create request from OpenStack.
- *
- * @param floatingIp floating IP information
- */
- void createFloatingIp(OpenstackFloatingIP floatingIp);
-
- /**
- * Handles floating IP update request from OpenStack.
- *
- * @param floatingIp floating IP information
- */
- void updateFloatingIp(OpenstackFloatingIP floatingIp);
-
- /**
- * Handles floating IP remove request from OpenStack.
- *
- * @param floatingIpId floating ip identifier
- */
- void deleteFloatingIp(String floatingIpId);
-
- /**
- * Handles to purge data plane flow of existing VM.
- *
- * @param host VM Host information
- */
- void purgeVmFlow(Host host);
-
- /**
- * Handles to reinstall data plane flow of existing VM.
- *
- * @param host VM Host information
- */
- void reinstallVmFlow(Host host);
-}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkAdminService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkAdminService.java
new file mode 100644
index 0000000..5ebb559
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkAdminService.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.openstack4j.model.network.Network;
+import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
+
+/**
+ * Service for administering the inventory of OpenStack network, subnet and port.
+ */
+public interface OpenstackNetworkAdminService {
+
+ /**
+ * Creates a network with the given information.
+ *
+ * @param network the new network
+ */
+ void createNetwork(Network network);
+
+ /**
+ * Updates the network with the given information.
+ *
+ * @param network the updated network
+ */
+ void updateNetwork(Network network);
+
+ /**
+ * Removes the network with the given network id.
+ *
+ * @param networkId network id
+ */
+ void removeNetwork(String networkId);
+
+ /**
+ * Creates a subnet with the given information.
+ *
+ * @param subnet the new subnet
+ */
+ void createSubnet(Subnet subnet);
+
+ /**
+ * Updates a subnet with the given information.
+ *
+ * @param subnet the updated subnet
+ */
+ void updateSubnet(Subnet subnet);
+
+ /**
+ * Removes the subnet with the given subnet id.
+ *
+ * @param subnetId subnet id
+ */
+ void removeSubnet(String subnetId);
+
+ /**
+ * Creates a port with the given information.
+ *
+ * @param port the new port
+ */
+ void createPort(Port port);
+
+ /**
+ * Updates the port with the given information.
+ *
+ * @param port the updated port
+ */
+ void updatePort(Port port);
+
+ /**
+ * Removes the port with the given port id.
+ *
+ * @param portId port id
+ */
+ void removePort(String portId);
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkEvent.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkEvent.java
new file mode 100644
index 0000000..c022c29
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkEvent.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.joda.time.LocalDateTime;
+import org.onosproject.event.AbstractEvent;
+import org.openstack4j.model.network.Network;
+import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Describes OpenStack network service event.
+ */
+public class OpenstackNetworkEvent extends AbstractEvent<OpenstackNetworkEvent.Type, Network> {
+
+ private final Port port;
+ private final Subnet subnet;
+
+ public enum Type {
+ /**
+ * Signifies that a new OpenStack network is created.
+ */
+ OPENSTACK_NETWORK_CREATED,
+
+ /**
+ * Signifies that the OpenStack network is updated.
+ */
+ OPENSTACK_NETWORK_UPDATED,
+
+ /**
+ * Signifies that the OpenStack network is removed.
+ */
+ OPENSTACK_NETWORK_REMOVED,
+
+ /**
+ * Signifies that a new OpenStack subnet is created.
+ */
+ OPENSTACK_SUBNET_CREATED,
+
+ /**
+ * Signifies that the OpenStack subnet is updated.
+ */
+ OPENSTACK_SUBNET_UPDATED,
+
+ /**
+ * Signifies that the OpenStack subnet is removed.
+ */
+ OPENSTACK_SUBNET_REMOVED,
+
+ /**
+ * Signifies that a new OpenStack port is created.
+ */
+ OPENSTACK_PORT_CREATED,
+
+ /**
+ * Signifies that the OpenStack port is updated.
+ */
+ OPENSTACK_PORT_UPDATED,
+
+ /**
+ * Signifies that the OpenStack port is removed.
+ */
+ OPENSTACK_PORT_REMOVED
+ }
+
+ /**
+ * Creates an event of a given type for the specified network and the current time.
+ * @param type openstack network event type
+ * @param network openstack network
+ */
+ public OpenstackNetworkEvent(Type type, Network network) {
+ super(type, network);
+ this.port = null;
+ this.subnet = null;
+ }
+
+ /**
+ * Creates an event of a given type for the specified network, port and the
+ * current time.
+ *
+ * @param type openstack network event type
+ * @param network openstack network
+ * @param port openstack port
+ */
+ public OpenstackNetworkEvent(Type type, Network network, Port port) {
+ super(type, network);
+ this.port = port;
+ this.subnet = null;
+ }
+
+ /**
+ * Creates an event of a given type for the specified network, subnet and the
+ * current time.
+ *
+ * @param type openstack network event type
+ * @param network openstack network
+ * @param subnet openstack subnet
+ */
+ public OpenstackNetworkEvent(Type type, Network network, Subnet subnet) {
+ super(type, network);
+ this.port = null;
+ this.subnet = subnet;
+ }
+
+ /**
+ * Returns the port of the network event.
+ *
+ * @return openstack port; null if the event is not port specific
+ */
+ public Port port() {
+ return port;
+ }
+
+ /**
+ * Returns the subnet of the network event.
+ *
+ * @return openstack subnet; null if the event is not subnet specific
+ */
+ public Subnet subnet() {
+ return subnet;
+ }
+
+ @Override
+ public String toString() {
+ if (port == null && subnet == null) {
+ return super.toString();
+ }
+ return toStringHelper(this)
+ .add("time", new LocalDateTime(time()))
+ .add("type", type())
+ .add("network", subject())
+ .add("port", port)
+ .add("subnet", subnet)
+ .toString();
+ }
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkListener.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkListener.java
new file mode 100644
index 0000000..1e824da
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.event.EventListener;
+
+/**
+ * Listener for OpenStack network event.
+ */
+public interface OpenstackNetworkListener extends EventListener<OpenstackNetworkEvent> {
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkService.java
new file mode 100644
index 0000000..78ac42d
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkService.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.event.ListenerService;
+import org.openstack4j.model.network.Network;
+import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
+
+import java.util.Set;
+
+/**
+ * Service for interacting with the inventory of OpenStack network and port.
+ */
+public interface OpenstackNetworkService
+ extends ListenerService<OpenstackNetworkEvent, OpenstackNetworkListener> {
+ /**
+ * Returns the network with the supplied network ID.
+ *
+ * @param networkId network id
+ * @return openstack network
+ */
+ Network network(String networkId);
+
+ /**
+ * Returns all networks registered in the service.
+ *
+ * @return set of networks
+ */
+ Set<Network> networks();
+
+ /**
+ * Returns the subnet with the supplied subnet ID.
+ *
+ * @param subnetId subnet id
+ * @return subnet
+ */
+ Subnet subnet(String subnetId);
+
+ /**
+ * Returns all subnets registered in the service.
+ *
+ * @return set of subnet
+ */
+ Set<Subnet> subnets();
+
+ /**
+ * Returns all subnets associated with the supplied network.
+ *
+ * @param networkId network id
+ * @return set of subnet
+ */
+ Set<Subnet> subnets(String networkId);
+
+ /**
+ * Returns the OpenStack port with the supplied port ID.
+ *
+ * @param portId openstack port id
+ * @return openstack port
+ */
+ Port port(String portId);
+
+ /**
+ * Returns the OpenStack port with the supplied ONOS port.
+ *
+ * @param port onos port
+ * @return openstack port
+ */
+ Port port(org.onosproject.net.Port port);
+
+ /**
+ * Returns all OpenStack ports registered in the service.
+ *
+ * @return set of ports
+ */
+ Set<Port> ports();
+
+ /**
+ * Returns all OpenStack ports associated with the supplied network.
+ * @param networkId network id
+ * @return set of ports
+ */
+ Set<Port> ports(String networkId);
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkStore.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkStore.java
new file mode 100644
index 0000000..86f338fe
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkStore.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.store.Store;
+import org.openstack4j.model.network.Network;
+import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
+
+import java.util.Set;
+
+/**
+ * Manages inventory of OpenStack network states; not intended for direct use.
+ */
+public interface OpenstackNetworkStore
+ extends Store<OpenstackNetworkEvent, OpenstackNetworkStoreDelegate> {
+
+ /**
+ * Creates the new network.
+ *
+ * @param network openstack network
+ */
+ void createNetwork(Network network);
+
+ /**
+ * Updates the network.
+ *
+ * @param network openstack network
+ */
+ void updateNetwork(Network network);
+
+ /**
+ * Removes the network with the given network id.
+ *
+ * @param networkId network id
+ * @return removed openstack network; null if failed
+ */
+ Network removeNetwork(String networkId);
+
+ /**
+ * Returns the network with the given network id.
+ *
+ * @param networkId network id
+ * @return network; null if not found
+ */
+ Network network(String networkId);
+
+ /**
+ * Returns all networks.
+ *
+ * @return set of networks
+ */
+ Set<Network> networks();
+
+ /**
+ * Creates a subnet with the given information.
+ *
+ * @param subnet the new subnet
+ */
+ void createSubnet(Subnet subnet);
+
+ /**
+ * Updates a subnet with the given information.
+ *
+ * @param subnet the updated subnet
+ */
+ void updateSubnet(Subnet subnet);
+
+ /**
+ * Removes the subnet with the given subnet id.
+ *
+ * @param subnetId subnet id
+ * @return removed subnet; null if failed
+ */
+ Subnet removeSubnet(String subnetId);
+
+ /**
+ * Returns the subnet with the supplied subnet ID.
+ *
+ * @param subnetId subnet id
+ * @return subnet
+ */
+ Subnet subnet(String subnetId);
+
+ /**
+ * Returns all subnets registered in the service.
+ *
+ * @return set of subnet
+ */
+ Set<Subnet> subnets();
+
+ /**
+ * Creates the new port.
+ *
+ * @param port the new port
+ */
+ void createPort(Port port);
+
+ /**
+ * Updates the port.
+ *
+ * @param port port
+ */
+ void updatePort(Port port);
+
+ /**
+ * Removes the port.
+ *
+ * @param portId port id
+ * @return removed port; null if failed
+ */
+ Port removePort(String portId);
+
+ /**
+ * Returns the port with the given port id.
+ *
+ * @param portId port id
+ * @return port
+ */
+ Port port(String portId);
+
+ /**
+ * Returns all ports.
+ *
+ * @return set of ports
+ */
+ Set<Port> ports();
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkStoreDelegate.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkStoreDelegate.java
new file mode 100644
index 0000000..ba8ce56
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackNetworkStoreDelegate.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.store.StoreDelegate;
+
+/**
+ * OpenStack network store delegate abstraction.
+ */
+public interface OpenstackNetworkStoreDelegate extends StoreDelegate<OpenstackNetworkEvent> {
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterAdminService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterAdminService.java
new file mode 100644
index 0000000..5870eb0
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterAdminService.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.openstack4j.model.network.NetFloatingIP;
+import org.openstack4j.model.network.Router;
+import org.openstack4j.model.network.RouterInterface;
+
+/**
+ * Service for administering the inventory of OpenStack router and floating IP.
+ */
+public interface OpenstackRouterAdminService {
+
+ /**
+ * Creates a router with the given information.
+ *
+ * @param osRouter the new router
+ */
+ void createRouter(Router osRouter);
+
+ /**
+ * Updates the router with the given information.
+ *
+ * @param osRouter updated router
+ */
+ void updateRouter(Router osRouter);
+
+ /**
+ * Removes the router with the given router ID.
+ *
+ * @param osRouterId router id
+ */
+ void removeRouter(String osRouterId);
+
+ /**
+ * Adds a new interface to the router.
+ *
+ * @param osRouterIface openstack router interface
+ */
+ void addRouterInterface(RouterInterface osRouterIface);
+
+ /**
+ * Updates the router interface.
+ *
+ * @param osRouterIface openstack router interface
+ */
+ void updateRouterInterface(RouterInterface osRouterIface);
+
+ /**
+ * Removes the router interface.
+ *
+ * @param osRouterIfaceId openstack router interface id
+ */
+ void removeRouterInterface(String osRouterIfaceId);
+
+ /**
+ * Creates a floating IP with the given information.
+ *
+ * @param floatingIP the new floating ip
+ */
+ void createFloatingIp(NetFloatingIP floatingIP);
+
+ /**
+ * Updates the floating IP with the given information.
+ *
+ * @param floatingIP the updated floating ip
+ */
+ void updateFloatingIp(NetFloatingIP floatingIP);
+
+ /**
+ * Removes the floating IP with the given floating IP ID.
+ *
+ * @param floatingIpId floating ip id
+ */
+ void removeFloatingIp(String floatingIpId);
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterEvent.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterEvent.java
new file mode 100644
index 0000000..4cf4d99
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterEvent.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.joda.time.LocalDateTime;
+import org.onosproject.event.AbstractEvent;
+import org.openstack4j.model.network.ExternalGateway;
+import org.openstack4j.model.network.NetFloatingIP;
+import org.openstack4j.model.network.Router;
+import org.openstack4j.model.network.RouterInterface;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Describes OpenStack router service events.
+ */
+public class OpenstackRouterEvent extends AbstractEvent<OpenstackRouterEvent.Type, Router> {
+
+ private final ExternalGateway exGateway;
+ private final RouterInterface routerIface;
+ private final NetFloatingIP floatingIP;
+ private final String portId;
+
+ public enum Type {
+
+ /**
+ * Signifies that a new OpenStack router is created.
+ */
+ OPENSTACK_ROUTER_CREATED,
+
+ /**
+ * Signifies that the OpenStack router is updated.
+ */
+ OPENSTACK_ROUTER_UPDATED,
+
+ /**
+ * Signifies that the OpenStack router is removed.
+ */
+ OPENSTACK_ROUTER_REMOVED,
+
+ /**
+ * Signifies that the external gateway is added to the router.
+ */
+ OPENSTACK_ROUTER_GATEWAY_ADDED,
+
+ /**
+ * Signifies that the external gateway is removed from the router.
+ */
+ OPENSTACK_ROUTER_GATEWAY_REMOVED,
+
+ /**
+ * Signifies that the OpenStack router interface is added.
+ */
+ OPENSTACK_ROUTER_INTERFACE_ADDED,
+
+ /**
+ * Signifies that the OpenStack router interface is updated.
+ */
+ OPENSTACK_ROUTER_INTERFACE_UPDATED,
+
+ /**
+ * Signifies that the OpenStack router interface is removed.
+ */
+ OPENSTACK_ROUTER_INTERFACE_REMOVED,
+
+ /**
+ * Signifies that a new floating IP is created.
+ */
+ OPENSTACK_FLOATING_IP_CREATED,
+
+ /**
+ * Signifies that the floating IP is updated.
+ */
+ OPENSTACK_FLOATING_IP_UPDATED,
+
+ /**
+ * Signifies that the floating IP is removed.
+ */
+ OPENSTACK_FLOATING_IP_REMOVED,
+
+ /**
+ * Signifies that the floating IP is associated to a fixed IP.
+ */
+ OPENSTACK_FLOATING_IP_ASSOCIATED,
+
+ /**
+ * Signifies that the floating IP disassociated from the fixed IP.
+ */
+ OPENSTACK_FLOATING_IP_DISASSOCIATED
+ }
+
+ /**
+ * Creates an event of a given type for the specified router and the current time.
+ *
+ * @param type openstack router event type
+ * @param osRouter openstack router
+ */
+ public OpenstackRouterEvent(Type type, Router osRouter) {
+ super(type, osRouter);
+ this.exGateway = null;
+ this.routerIface = null;
+ this.floatingIP = null;
+ this.portId = null;
+ }
+
+ /**
+ * Creates an event of a given type for the specified router, external gateway and
+ * the current time.
+ *
+ * @param type openstack router event type
+ * @param osRouter openstack router
+ * @param exGateway openstack router external gateway
+ */
+ public OpenstackRouterEvent(Type type, Router osRouter, ExternalGateway exGateway) {
+ super(type, osRouter);
+ this.exGateway = exGateway;
+ this.routerIface = null;
+ this.floatingIP = null;
+ this.portId = null;
+ }
+
+ /**
+ * Creates an event of a given type for the specified router, floating IP and
+ * the current time.
+ *
+ * @param type openstack router event type
+ * @param osRouter openstack router
+ * @param osRouterIface openstack router interface
+ */
+ public OpenstackRouterEvent(Type type, Router osRouter, RouterInterface osRouterIface) {
+ super(type, osRouter);
+ this.exGateway = null;
+ this.routerIface = osRouterIface;
+ this.floatingIP = null;
+ this.portId = null;
+ }
+
+ /**
+ * Creates an event of a given type for the specified router, floating IP and
+ * the current time.
+ *
+ * @param type openstack router event type
+ * @param router openstack router
+ * @param floatingIP openstack floating ip
+ */
+ public OpenstackRouterEvent(Type type, Router router, NetFloatingIP floatingIP) {
+ super(type, router);
+ this.exGateway = null;
+ this.routerIface = null;
+ this.floatingIP = floatingIP;
+ this.portId = null;
+ }
+
+ /**
+ * Creates an event of a given type for the specified router, floating IP,
+ * associated OpenStack port ID and the current time.
+ *
+ * @param type openstack router event type
+ * @param router openstack router
+ * @param floatingIP openstack floating ip
+ * @param portId associated openstack port id
+ */
+ public OpenstackRouterEvent(Type type, Router router, NetFloatingIP floatingIP,
+ String portId) {
+ super(type, router);
+ this.exGateway = null;
+ this.routerIface = null;
+ this.floatingIP = floatingIP;
+ this.portId = portId;
+ }
+
+ /**
+ * Returns the router external gateway object of the router event.
+ *
+ * @return openstack router external gateway; null if the event is not
+ * relevant to the router external gateway
+ */
+ public ExternalGateway externalGateway() {
+ return exGateway;
+ }
+
+ /**
+ * Returns the router interface object of the router event.
+ *
+ * @return openstack router interface; null if the event is not relevant to
+ * the router interface
+ */
+ public RouterInterface routerIface() {
+ return routerIface;
+ }
+
+ /**
+ * Returns the floating IP of the router event.
+ *
+ * @return openstack floating ip; null if the event is not relevant to
+ * the floating ip
+ */
+ public NetFloatingIP floatingIp() {
+ return floatingIP;
+ }
+
+ /**
+ * Returns the associated port ID of the floating IP.
+ *
+ * @return openstack port id; null if the event is not relevant to the
+ * floating ip
+ */
+ public String portId() {
+ return portId;
+ }
+
+ @Override
+ public String toString() {
+ if (floatingIP == null) {
+ return super.toString();
+ }
+ return toStringHelper(this)
+ .add("time", new LocalDateTime(time()))
+ .add("type", type())
+ .add("router", subject())
+ .add("externalGateway", exGateway)
+ .add("routerIface", routerIface)
+ .add("floatingIp", floatingIP)
+ .add("portId", portId)
+ .toString();
+ }
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterListener.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterListener.java
new file mode 100644
index 0000000..2442d79
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterListener.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.event.EventListener;
+
+/**
+ * Listener for OpenStack router event.
+ */
+public interface OpenstackRouterListener extends EventListener<OpenstackRouterEvent> {
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterService.java
new file mode 100644
index 0000000..75c1378
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterService.java
@@ -0,0 +1,90 @@
+/*
+ * 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.api;
+
+import org.onosproject.event.ListenerService;
+import org.openstack4j.model.network.NetFloatingIP;
+import org.openstack4j.model.network.Router;
+import org.openstack4j.model.network.RouterInterface;
+
+import java.util.Set;
+
+/**
+ * Handles router update requests from OpenStack.
+ */
+public interface OpenstackRouterService
+ extends ListenerService<OpenstackRouterEvent, OpenstackRouterListener> {
+
+ /**
+ * Returns the router with the supplied router ID.
+ *
+ * @param osRouterId openstack router id
+ * @return openstack router
+ */
+ Router router(String osRouterId);
+
+ /**
+ * Returns all routers.
+ *
+ * @return set of openstack routers
+ */
+ Set<Router> routers();
+
+ /**
+ * Returns the router interface with the given ID.
+ *
+ * @param osRouterIfaceId openstack router interface port id
+ * @return openstack router interface
+ */
+ RouterInterface routerInterface(String osRouterIfaceId);
+
+ /**
+ * Returns all router interfaces.
+ *
+ * @return set of openstack router interfaces
+ */
+ Set<RouterInterface> routerInterfaces();
+
+ /**
+ * Returns all router interfaces with the router ID.
+ *
+ * @param osRouterId openstack router id
+ * @return set of router interfaces
+ */
+ Set<RouterInterface> routerInterfaces(String osRouterId);
+
+ /**
+ * Returns the floating IP with the supplied floating IP ID.
+ * @param floatingIpId floating ip id
+ * @return openstack floating ip
+ */
+ NetFloatingIP floatingIp(String floatingIpId);
+
+ /**
+ * Returns all floating IPs.
+ *
+ * @return set of openstack floating ips
+ */
+ Set<NetFloatingIP> floatingIps();
+
+ /**
+ * Returns all floating IPs associated with the router ID.
+ *
+ * @param routerId router id
+ * @return set of openstack floating ips
+ */
+ Set<NetFloatingIP> floatingIps(String routerId);
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterStore.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterStore.java
new file mode 100644
index 0000000..b0744a0
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterStore.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.store.Store;
+import org.openstack4j.model.network.NetFloatingIP;
+import org.openstack4j.model.network.Router;
+import org.openstack4j.model.network.RouterInterface;
+
+import java.util.Set;
+
+/**
+ * Manages inventory of OpenStack router states; not intended for direct use.
+ */
+public interface OpenstackRouterStore
+ extends Store<OpenstackRouterEvent, OpenstackRouterStoreDelegate> {
+
+ /**
+ * Creates a new router.
+ *
+ * @param osRouter openstack router
+ */
+ void createRouter(Router osRouter);
+
+ /**
+ * Updates the router.
+ *
+ * @param osRouter updated openstack router
+ */
+ void updateRouter(Router osRouter);
+
+ /**
+ * Removes the router with the supplied ID.
+ *
+ * @param osRouterId openstack router id
+ * @return removed router; null if failed
+ */
+ Router removeRouter(String osRouterId);
+
+ /**
+ * Returns the router with the supplied router ID.
+ *
+ * @param osRouterId openstack router id
+ * @return openstack router; null if not found
+ */
+ Router router(String osRouterId);
+
+ /**
+ * Returns all routers.
+ *
+ * @return set of openstack router
+ */
+ Set<Router> routers();
+
+ /**
+ * Adds a new interface to the router.
+ *
+ * @param osRouterIface openstack router interface
+ */
+ void addRouterInterface(RouterInterface osRouterIface);
+
+ /**
+ * Updates the router interface.
+ *
+ * @param osRouterIface openstack router interface
+ */
+ void updateRouterInterface(RouterInterface osRouterIface);
+
+ /**
+ * Removes the router interface.
+ *
+ * @param osRouterIfaceId openstack router interface id
+ * @return removed router interface; null if failed
+ */
+ RouterInterface removeRouterInterface(String osRouterIfaceId);
+
+ /**
+ * Returns the router interface with the given ID.
+ *
+ * @param osRouterIfaceId openstack router interface port id
+ * @return openstack router interface
+ */
+ RouterInterface routerInterface(String osRouterIfaceId);
+
+ /**
+ * Returns all router interfaces.
+ *
+ * @return set of openstack router interfaces
+ */
+ Set<RouterInterface> routerInterfaces();
+
+ /**
+ * Creates a new floating IP address.
+ *
+ * @param floatingIp openstack floating ip
+ */
+ void createFloatingIp(NetFloatingIP floatingIp);
+
+ /**
+ * Updates the floating IP address.
+ *
+ * @param floatingIp updated openstack floating ip
+ */
+ void updateFloatingIp(NetFloatingIP floatingIp);
+
+ /**
+ * Removes the floating IP with the supplied ID.
+ *
+ * @param floatingIpId floating ip id
+ * @return removed floating ip; null if failed
+ */
+ NetFloatingIP removeFloatingIp(String floatingIpId);
+
+ /**
+ * Returns the floating IP with the supplied ID.
+ *
+ * @param floatingIpId floating ip id
+ * @return openstack floating ip; null if not found
+ */
+ NetFloatingIP floatingIp(String floatingIpId);
+
+ /**
+ * Returns all floating IP addresses.
+ *
+ * @return openstack floating ip; empty set if no floating ip exists
+ */
+ Set<NetFloatingIP> floatingIps();
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterStoreDelegate.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterStoreDelegate.java
new file mode 100644
index 0000000..12ce679
--- /dev/null
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRouterStoreDelegate.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2017-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.api;
+
+import org.onosproject.store.StoreDelegate;
+
+/**
+ * OpenStack router store delegate abstraction.
+ */
+public interface OpenstackRouterStoreDelegate extends StoreDelegate<OpenstackRouterEvent> {
+}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRoutingService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRoutingService.java
deleted file mode 100644
index 29e492e..0000000
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackRoutingService.java
+++ /dev/null
@@ -1,79 +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.api;
-
-import org.onosproject.net.Host;
-
-import org.onosproject.openstackinterface.OpenstackRouter;
-import org.onosproject.openstackinterface.OpenstackRouterInterface;
-
-/**
- * Handles router update requests from OpenStack.
- */
-public interface OpenstackRoutingService {
-
- /**
- * Handles the router create request from OpenStack.
- *
- * @param osRouter router information
- */
- void createRouter(OpenstackRouter osRouter);
-
- /**
- * Handles the router update request from OpenStack.
- * Update router is called when the name, administrative state, or the external
- * gateway setting is updated. The external gateway update is the only case
- * that openstack routing service cares.
- *
- * @param osRouter router information
- */
- void updateRouter(OpenstackRouter osRouter);
-
- /**
- * Handles the router remove request from OpenStack.
- *
- * @param osRouterId identifier of the router
- */
- void removeRouter(String osRouterId);
-
- /**
- * Handles router interface add request from OpenStack.
- *
- * @param osInterface router interface information
- */
- void addRouterInterface(OpenstackRouterInterface osInterface);
-
- /**
- * Handles router interface remove request from OpenStack.
- *
- * @param osInterface router interface information
- */
- void removeRouterInterface(OpenstackRouterInterface osInterface);
-
- /**
- * Handles to purge data plane flow of existing VM.
- *
- * @param host VM Host information
- */
- void purgeVmFlow(Host host);
-
- /**
- * Handles to reinstall data plane flow of existing VM.
- *
- * @param host VM Host information
- */
- void reinstallVmFlow(Host host);
-}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackSecurityGroupService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackSecurityGroupService.java
deleted file mode 100644
index 1709c95..0000000
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackSecurityGroupService.java
+++ /dev/null
@@ -1,47 +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.api;
-
-import org.onosproject.net.Host;
-
-import org.onosproject.openstackinterface.OpenstackPort;
-
-/**
- * Represents OpenstackSecurityGroupService Interface.
- */
-public interface OpenstackSecurityGroupService {
-
- /**
- * Updates the flow rules for Security Group for the VM (OpenstackPort).
- *
- * @param osPort OpenstackPort information for the VM
- */
- void updateSecurityGroup(OpenstackPort osPort);
-
- /**
- * Handles to purge data plane flow of existing VM.
- *
- * @param host VM Host information
- */
- void purgeVmFlow(Host host);
-
- /**
- * Handles to reinstall data plane flow of existing VM.
- *
- * @param host VM Host information
- */
- void reinstallVmFlow(Host host);
-}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackSwitchingService.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackSwitchingService.java
deleted file mode 100644
index dc1113e..0000000
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/OpenstackSwitchingService.java
+++ /dev/null
@@ -1,37 +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.api;
-
-import org.onosproject.net.Host;
-
-/**
- * Handles switch update requests from OpenStack and CLI.
- */
-public interface OpenstackSwitchingService {
- /**
- * Handles to purge data plane flow of existing VM.
- *
- * @param host VM Host information
- */
- void purgeVmFlow(Host host);
-
- /**
- * Handles to reinstall data plane flow of existing VM.
- *
- * @param host VM Host information
- */
- void reinstallVmFlow(Host host);
-}
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/package-info.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/package-info.java
index 0cd17c1..1696e21 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/package-info.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/api/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-present Open Networking Laboratory
+ * Copyright 2017-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.
@@ -15,6 +15,8 @@
*/
/**
- * Application for OpenstackRouting.
+ * Implements OpenStack L3 service plugin, which routes packets between subnets,
+ * forwards packets from internal networks to external ones, and accesses instances
+ * from external networks through floating IPs.
*/
-package org.onosproject.openstacknetworking.api;
\ No newline at end of file
+package org.onosproject.openstacknetworking.api;