Separated OpenstackInterface feature from OpenstackNetworking application.
Change-Id: I4766de7e93c5b432c50a2167b9a9d9d4605b1ad2
diff --git a/apps/openstacknetworking/api/pom.xml b/apps/openstacknetworking/api/pom.xml
index b4ad7c1..ba59f98 100644
--- a/apps/openstacknetworking/api/pom.xml
+++ b/apps/openstacknetworking/api/pom.xml
@@ -31,6 +31,11 @@
<dependencies>
<dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-app-openstackinterface-api</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackExternalGateway.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackExternalGateway.java
deleted file mode 100644
index 4005f88..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackExternalGateway.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright 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.
- * 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 com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import org.onlab.packet.Ip4Address;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * A configurable external gateway modes extension model in openstack router.
- */
-public final class OpenstackExternalGateway {
-
- private final String networkId;
- private final boolean enablePnat;
- private final Map<String, Ip4Address> externalFixedIps;
-
- private OpenstackExternalGateway(String networkId, boolean enablePnat,
- Map<String, Ip4Address> externalFixedIps) {
- this.networkId = networkId;
- this.enablePnat = enablePnat;
- this.externalFixedIps = externalFixedIps;
- }
-
- /**
- * Returns network ID.
- *
- * @return Network ID
- */
- public String networkId() {
- return networkId;
- }
-
- /**
- * Returns the PNAT status for external gateway.
- *
- * @return PNAT status
- */
- public boolean isEnablePnat() {
- return enablePnat;
- }
-
- /**
- * Returns external fixed IP informations.
- *
- * @return External fixed IP informations
- */
- public Map<String, Ip4Address> externalFixedIps() {
- return ImmutableMap.copyOf(externalFixedIps);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (o instanceof OpenstackExternalGateway) {
- OpenstackExternalGateway that = (OpenstackExternalGateway) o;
-
- return this.networkId.equals(that.networkId) &&
- this.enablePnat == that.enablePnat &&
- this.externalFixedIps.equals(that.externalFixedIps);
- }
-
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(networkId, enablePnat, externalFixedIps);
- }
-
- /**
- * An Openstack External Gateway Builder class.
- */
- public static final class Builder {
- private String networkId;
- private boolean enablePnat;
- private Map<String, Ip4Address> externalFixedIps;
-
- public Builder() {
- externalFixedIps = Maps.newHashMap();
- }
-
- /**
- * Sets network ID.
- *
- * @param networkId Network ID
- * @return Builder object
- */
- public Builder networkId(String networkId) {
- this.networkId = networkId;
- return this;
- }
-
- /**
- * Sets whether PNAT status is enabled or not.
- *
- * @param enablePnat true if PNAT status is enabled, false otherwise
- * @return Builder object
- */
- public Builder enablePnat(boolean enablePnat) {
- this.enablePnat = enablePnat;
- return this;
- }
-
- /**
- * Sets external fixed IP address information.
- *
- * @param externalFixedIps External fixed IP information
- * @return Builder object
- */
-
- public Builder externalFixedIps(Map<String, Ip4Address> externalFixedIps) {
- this.externalFixedIps.putAll(externalFixedIps);
- return this;
- }
-
- /**
- * Builds an OpenstackExternalGateway object.
- *
- * @return OpenstackExternalGateway object
- */
- public OpenstackExternalGateway build() {
- return new OpenstackExternalGateway(networkId, enablePnat, ImmutableMap.copyOf(externalFixedIps));
- }
- }
-
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackFloatingIP.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackFloatingIP.java
deleted file mode 100644
index 569c885..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackFloatingIP.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright 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.
- * 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 java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An Openstack Neutron Floating IP Model.
- */
-public final class OpenstackFloatingIP {
-
- public enum FloatingIpStatus {
- UP,
- DOWN,
- ACTIVE,
- }
-
- private final String tenantId;
- private final String networkId;
- private final Ip4Address fixedIpAddress;
- private String portId;
- private String routerId;
- private final String id;
- private final Ip4Address floatingIpAddress;
- private final FloatingIpStatus status;
-
- private OpenstackFloatingIP(FloatingIpStatus status, String id, String tenantId,
- String networkId, Ip4Address fixedIpAddress, String portId,
- String routerId, Ip4Address floatingIpAddress) {
- this.status = status;
- this.id = id;
- this.tenantId = tenantId;
- this.networkId = networkId;
- this.fixedIpAddress = fixedIpAddress;
- this.portId = portId;
- this.routerId = routerId;
- this.floatingIpAddress = floatingIpAddress;
- }
-
- /**
- * Returns floating IP status.
- *
- * @return floating IP status
- */
- public FloatingIpStatus status() {
- return status;
- }
-
- /**
- * Returns floating IP`s ID.
- *
- * @return floating IP`s ID
- */
- public String id() {
- return id;
- }
-
- /**
- * Returns tenant ID.
- *
- * @return tenant ID
- */
- public String tenantId() {
- return tenantId;
- }
-
- /**
- * Returns network ID.
- *
- * @return network ID
- */
- public String networkId() {
- return networkId;
- }
-
- /**
- * Returns fixed IP Address.
- *
- * @return fixed IP Address
- */
- public Ip4Address fixedIpAddress() {
- return fixedIpAddress;
- }
-
- /**
- * Returns port ID.
- *
- * @return port ID
- */
- public String portId() {
- return portId;
- }
-
- /**
- * Updates port ID.
- *
- * @param portId Updated port ID
- */
- public void updatePortId(String portId) {
- this.portId = portId;
- }
-
- /**
- * Returns router ID.
- *
- * @return router ID
- */
- public String routerId() {
- return routerId;
- }
-
- /**
- * Updates router ID.
- *
- * @param routerId Updated router ID
- */
- public void updateRouterId(String routerId) {
- this.routerId = routerId;
- }
-
- /**
- * Returns floating IP address.
- *
- * @return Floating IP address
- */
- public Ip4Address floatingIpAddress() {
- return floatingIpAddress;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (o instanceof OpenstackFloatingIP) {
- OpenstackFloatingIP that = (OpenstackFloatingIP) o;
-
- return this.status.equals(that.status) &&
- this.id.equals(that.id) &&
- this.tenantId.equals(that.tenantId) &&
- this.networkId.equals(that.networkId) &&
- this.fixedIpAddress.equals(that.fixedIpAddress) &&
- this.floatingIpAddress.equals(that.floatingIpAddress) &&
- this.portId.equals(that.portId) &&
- this.routerId.equals(that.routerId);
- }
-
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(status, id, tenantId, networkId, floatingIpAddress, fixedIpAddress, portId, routerId);
- }
-
- /**
- * An Openstack Floating IP Builder class.
- */
- public static final class Builder {
- private String tenantId;
- private String networkId;
- private Ip4Address fixedIpAddress;
- private String portId;
- private String routerId;
- private String id;
- private Ip4Address floatingIpAddress;
- private FloatingIpStatus status;
-
- /**
- * Sets tenant ID.
- *
- * @param tenantId tenant ID
- * @return Builder object
- */
- public Builder tenantId(String tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- /**
- * Sets floating IP status.
- *
- * @param status Floating IP status
- * @return Builder object
- */
- public Builder status(FloatingIpStatus status) {
- this.status = status;
- return this;
- }
-
- /**
- * Sets Floating IP`s ID.
- *
- * @param id Floating IP`s ID
- * @return Builder object
- */
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Sets network ID.
- *
- * @param networkId Network ID
- * @return Builder object
- */
- public Builder networkId(String networkId) {
- this.networkId = networkId;
- return this;
- }
-
- /**
- * Sets fixed IP address.
- *
- * @param fixedIpAddress Fixed IP address
- * @return Builder object
- */
- public Builder fixedIpAddress(Ip4Address fixedIpAddress) {
- this.fixedIpAddress = fixedIpAddress;
- return this;
- }
-
- /**
- * Sets port ID.
- *
- * @param portId port ID
- * @return Builder object
- */
- public Builder portId(String portId) {
- this.portId = portId;
- return this;
- }
-
- /**
- * Sets router ID.
- *
- * @param routerId router ID
- * @return Builder object
- */
- public Builder routerId(String routerId) {
- this.routerId = routerId;
- return this;
- }
-
- /**
- * Sets floating IP address.
- *
- * @param floatingIpAddress Floating IP address
- * @return Builder object
- */
- public Builder floatingIpAddress(Ip4Address floatingIpAddress) {
- this.floatingIpAddress = floatingIpAddress;
- return this;
- }
-
- /**
- * Builds an OpenstackFloatingIP object.
- *
- * @return OpenstackFloatingIP object
- */
- public OpenstackFloatingIP build() {
- return new OpenstackFloatingIP(checkNotNull(status), checkNotNull(id), checkNotNull(tenantId),
- checkNotNull(networkId), fixedIpAddress, portId,
- routerId, checkNotNull(floatingIpAddress));
-
- }
- }
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetwork.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetwork.java
deleted file mode 100644
index 23a0674..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetwork.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.openstacknetworking;
-
-import java.util.Collection;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-
-/**
- * Represents the network information given by Neutron.
- */
-public final class OpenstackNetwork {
-
- private String name;
- private String tenantId;
- private String segmentId;
- private String id;
- private NetworkType networkType;
- private Collection<OpenstackSubnet> subnets;
-
- public enum NetworkType {
- /**
- * Currently only VXLAN moded is supported.
- */
- VXLAN
- }
-
- /**
- * Returns the builder object of the OpenstackNetwork class.
- *
- * @return OpenstackNetwork builder object
- */
- public static OpenstackNetwork.Builder builder() {
- return new Builder();
- }
-
- private OpenstackNetwork(String name, String tenantId, String id, String sid,
- NetworkType type, Collection<OpenstackSubnet> subnets) {
- this.name = checkNotNull(name);
- this.tenantId = checkNotNull(tenantId);
- this.segmentId = checkNotNull(sid);
- this.id = checkNotNull(id);
- this.networkType = type;
- this.subnets = subnets;
- }
-
- public String name() {
- return this.name;
- }
-
- public String tenantId() {
- return this.tenantId;
- }
-
- public String id() {
- return this.id;
- }
-
- public String segmentId() {
- return this.segmentId;
- }
-
- public NetworkType networkType() {
- return this.networkType;
- }
-
- public Collection<OpenstackSubnet> subnets() {
- return this.subnets;
- }
-
- @Override
- protected Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public static final class Builder {
- private String name;
- private String tenantId;
- private String id;
- private String sid;
- private NetworkType networkType;
- private Collection<OpenstackSubnet> subnets;
-
- public Builder name(String name) {
- this.name = name;
-
- return this;
- }
-
- public Builder tenantId(String tenantId) {
- this.tenantId = tenantId;
-
- return this;
- }
-
- public Builder id(String id) {
- this.id = id;
-
- return this;
- }
-
- public Builder segmentId(String sid) {
- this.sid = sid;
-
- return this;
- }
-
- public Builder networkType(NetworkType type) {
- this.networkType = type;
-
- return this;
- }
-
- public Builder subnets(Collection<OpenstackSubnet> subnets) {
- this.subnets = subnets;
-
- return this;
- }
-
- public OpenstackNetwork build() {
- return new OpenstackNetwork(name, tenantId, id, sid, networkType, subnets);
- }
- }
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingConfig.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingConfig.java
deleted file mode 100644
index 37e9c06..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingConfig.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.
- * 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.onosproject.core.ApplicationId;
-import org.onosproject.net.config.Config;
-import org.onosproject.net.config.basics.BasicElementConfig;
-
-/**
- * Handles configuration for OpenstackSwitching app.
- */
-public class OpenstackNetworkingConfig extends Config<ApplicationId> {
- public static final String DONOTPUSH = "do_not_push_flows";
- public static final String NEUTRON_SERVER = "neutron_server";
- public static final String KEYSTONE_SERVER = "keystone_server";
- public static final String USER_NAME = "user_name";
- public static final String PASSWORD = "password";
- public static final String PHYSICAL_ROUTER_MAC = "physicalRouterMac";
-
- /**
- * Returns the flag whether the app pushes flows or not.
- *
- * @return the flag or false if not set
- */
- public boolean doNotPushFlows() {
- String flag = get(DONOTPUSH, "false");
- return Boolean.valueOf(flag);
- }
-
- /**
- * Returns the Neutron server IP address.
- *
- * @return Neutron server IP
- */
- public String neutronServer() {
- return get(NEUTRON_SERVER, "");
- }
-
- /**
- * Returns the Keystone server IP address.
- *
- * @return Keystone server IP
- */
- public String keystoneServer() {
- return get(KEYSTONE_SERVER, "");
- }
-
- /**
- * Returns the username for openstack.
- *
- * @return username for openstack
- */
- public String userName() {
- return get(USER_NAME, "");
- }
-
- /**
- * Returns the password for openstack.
- *
- * @return password for openstack
- */
- public String password() {
- return get(PASSWORD, "");
- }
-
- /**
- * Returns the MacAddress for physical router.
- *
- * @return physical router mac
- */
- public String physicalRouterMac() {
- return get(PHYSICAL_ROUTER_MAC, "");
- }
- /**
- * Sets the flag whether the app pushes flows or not.
- *
- * @param flag the flag whether the app pushes flows or not
- * @return self
- */
- public BasicElementConfig doNotPushFlows(boolean flag) {
- return (BasicElementConfig) setOrClear(DONOTPUSH, flag);
- }
-
- /**
- * Sets the neutron server IP address.
- *
- * @param url neutron server IP address
- * @return itself
- */
- public BasicElementConfig neutronServer(String url) {
- return (BasicElementConfig) setOrClear(NEUTRON_SERVER, url);
- }
-
- /**
- * Sets the keystone server IP address.
- *
- * @param url keystone server IP address
- * @return itself
- */
- public BasicElementConfig keystoneServer(String url) {
- return (BasicElementConfig) setOrClear(KEYSTONE_SERVER, url);
- }
-
- /**
- * Sets the username for openstack.
- *
- * @param username user name for openstack
- * @return itself
- */
- public BasicElementConfig userName(String username) {
- return (BasicElementConfig) setOrClear(USER_NAME, username);
- }
-
- /**
- * Sets the password for openstack.
- *
- * @param password password for openstack
- * @return itself
- */
- public BasicElementConfig password(String password) {
- return (BasicElementConfig) setOrClear(PASSWORD, password);
- }
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingService.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingService.java
deleted file mode 100644
index 6bd6bf8..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackNetworkingService.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.
- * 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.onosproject.net.Port;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * Handles port management REST API from Openstack for VMs.
- */
-public interface OpenstackNetworkingService {
-
- /**
- * Returns port information list for the network ID given.
- *
- * @param networkId Network ID of the ports
- * @return port information list
- */
- 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
- * @return port information
- */
- OpenstackPort port(Port port);
-
- /**
- * Returns port information for the port ID given.
- *
- * @param portId Port ID
- * @return port information
- */
- OpenstackPort port(String portId);
-
- /**
- * Returns network information list for the network ID given.
- *
- * @param networkId Network ID
- * @return network information, or null if not present
- */
- OpenstackNetwork network(String networkId);
-
- /**
- * Returns the information of all openstack networks.
- *
- * @return collection of network information
- */
- Collection<OpenstackNetwork> networks();
-
- /**
- * Returns subnet information for the subnet ID give.
- *
- * @param subnetId Subnet ID
- * @return subnet information, or null if not present
- */
- OpenstackSubnet subnet(String subnetId);
-
- /**
- * Returns collection of openstack subnet information.
- *
- * @return collection of openststack subnet information
- */
- Collection<OpenstackSubnet> subnets();
-
- /**
- * 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);
-
- /**
- * Retruns OpenstackPortInfo map.
- *
- * @return OpenstackPortInfo map
- */
- Map<String, OpenstackPortInfo> openstackPortInfo();
-
- /**
- * Sets configurations specified by net-config.xml file.
- *
- * @param neutronUrl neutron server url
- * @param keystoneUrl keystone server url
- * @param userName horizon user name
- * @param pass horizon passowrd
- */
- void setConfigurations(String neutronUrl, String keystoneUrl, String userName, String pass);
-
- /**
- * Returns Security Group information of the security groupd id given.
- *
- * @param id security group id
- * @return security group information
- */
- OpenstackSecurityGroup getSecurityGroup(String id);
-
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPort.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPort.java
deleted file mode 100644
index 13bcb0e..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackPort.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * 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.openstacknetworking;
-
-import com.google.common.collect.Maps;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * It represents the Openstack Port information.
- */
-public final class OpenstackPort {
-
- public enum PortStatus {
- UP,
- DOWN,
- ACTIVE,
- NA,
- }
-
- private PortStatus status;
- private String name;
- private Map<IpAddress, MacAddress> allowedAddressPairs;
- private boolean adminStateUp;
- private String networkId;
- private String tenantId;
- private String deviceOwner;
- private MacAddress macAddress;
- // <subnet id, ip address>
- private HashMap<String, Ip4Address> fixedIps;
- private String id;
- private Collection<String> securityGroups;
- private String deviceId;
-
- private OpenstackPort(PortStatus status, String name, Map<IpAddress, MacAddress> allowedAddressPairs,
- boolean adminStateUp, String networkId, String tenantId,
- String deviceOwner, MacAddress macAddress, HashMap fixedIps,
- String id, Collection<String> securityGroups, String deviceId) {
- this.status = status;
- this.name = name;
- this.allowedAddressPairs = checkNotNull(allowedAddressPairs);
- this.adminStateUp = adminStateUp;
- this.networkId = checkNotNull(networkId);
- this.tenantId = checkNotNull(tenantId);
- this.deviceOwner = deviceOwner;
- this.macAddress = checkNotNull(macAddress);
- this.fixedIps = checkNotNull(fixedIps);
- this.id = checkNotNull(id);
- this.securityGroups = securityGroups;
- this.deviceId = deviceId;
- }
-
-
-
- /**
- * Returns OpenstackPort builder object.
- *
- * @return OpenstackPort builder
- */
- public static OpenstackPort.Builder builder() {
- return new Builder();
- }
-
- /**
- * Returns port status.
- *
- * @return port status
- */
- public PortStatus status() {
- return status;
- }
-
- /**
- * Returns port name.
- *
- * @return port name
- */
- public String name() {
- return name;
- }
-
- /**
- * Returns allowed address pairs.
- *
- * @return map of ip address and mac address, or empty map
- */
- public Map<IpAddress, MacAddress> allowedAddressPairs() {
- return allowedAddressPairs;
- }
-
- /**
- * Returns whether admin state up or not.
- *
- * @return true if admin state up, false otherwise
- */
- public boolean isAdminStateUp() {
- return adminStateUp;
- }
-
- /**
- * Returns network ID.
- *
- * @return network ID
- */
- public String networkId() {
- return networkId;
- }
-
- /**
- * Returns device owner.
- *
- * @return device owner
- */
- public String deviceOwner() {
- return deviceOwner;
- }
-
- /**
- * Returns mac address.
- *
- * @return mac address
- */
- public MacAddress macAddress() {
- return macAddress;
- }
-
- /**
- * Returns the fixed IP information.
- *
- * @return fixed IP info
- */
- public HashMap fixedIps() {
- return fixedIps;
- }
-
- /**
- * Returns port ID.
- *
- * @return port ID
- */
- public String id() {
- return id;
- }
-
- /**
- * Returns security group information.
- *
- * @return security group info
- */
- public Collection<String> securityGroups() {
- return securityGroups;
- }
-
- /**
- * Returns device ID.
- *
- * @return device ID
- */
- public String deviceId() {
- return deviceId;
- }
-
- /**
- * OpenstackPort Builder class.
- */
- public static final class Builder {
-
- private PortStatus status;
- private String name;
- private Map<IpAddress, MacAddress> allowedAddressPairs;
- private boolean adminStateUp;
- private String networkId;
- private String tenantId;
- private String deviceOwner;
- private MacAddress macAddress;
- // list of hash map <subnet id, ip address>
- private HashMap<String, Ip4Address> fixedIps;
- private String id;
- private Collection<String> securityGroups;
- private String deviceId;
-
- Builder() {
- fixedIps = Maps.newHashMap();
- allowedAddressPairs = Maps.newHashMap();
- }
-
- /**
- * Sets port status.
- *
- * @param status port status
- * @return Builder object
- */
- public Builder portStatus(PortStatus status) {
- this.status = status;
-
- return this;
- }
-
- /**
- * Sets port name.
- *
- * @param name port name
- * @return Builder object
- */
- public Builder name(String name) {
- this.name = name;
-
- return this;
- }
-
- /**
- * Sets allowed address pairs.
- *
- * @param addrPairs map of ip address and mac address
- * @return Builder object
- */
- public Builder allowedAddressPairs(Map<IpAddress, MacAddress> addrPairs) {
- this.allowedAddressPairs.putAll(addrPairs);
- return this;
- }
-
- /**
- * Sets whether admin state up or not.
- *
- * @param isAdminStateUp true if admin state is up, false otherwise
- * @return Builder object
- */
- public Builder adminState(boolean isAdminStateUp) {
- this.adminStateUp = isAdminStateUp;
-
- return this;
- }
-
- /**
- * Sets network ID.
- *
- * @param networkId network ID
- * @return Builder object
- */
- public Builder netwrokId(String networkId) {
- this.networkId = networkId;
-
- return this;
- }
-
- /**
- * Sets tenant ID.
- *
- * @param tenantId tenant ID
- * @return Builder object
- */
- public Builder tenantId(String tenantId) {
- this.tenantId = tenantId;
-
- return this;
- }
-
- /**
- * Sets device owner.
- *
- * @param owner device owner
- * @return Builder object
- */
- public Builder deviceOwner(String owner) {
- this.deviceOwner = owner;
-
- return this;
- }
-
- /**
- * Sets MAC address of the port.
- *
- * @param mac MAC address
- * @return Builder object
- */
- public Builder macAddress(MacAddress mac) {
- this.macAddress = mac;
-
- return this;
- }
-
- /**
- * Sets Fixed IP address information.
- *
- * @param fixedIpList Fixed IP info
- * @return Builder object
- */
- public Builder fixedIps(HashMap<String, Ip4Address> fixedIpList) {
- fixedIps.putAll(fixedIpList);
-
- return this;
- }
-
- /**
- * Sets ID of the port.
- *
- * @param id ID of the port
- * @return Builder object
- */
- public Builder id(String id) {
- this.id = id;
-
- return this;
- }
-
- /**
- * Sets security group of the port.
- *
- * @param securityGroupList security group list of the port
- * @return Builder object
- */
- public Builder securityGroup(Collection<String> securityGroupList) {
- this.securityGroups = securityGroupList;
- return this;
- }
-
- /**
- * Sets device ID of the port.
- *
- * @param deviceId device ID
- * @return Builder object
- */
- public Builder deviceId(String deviceId) {
- this.deviceId = deviceId;
-
- return this;
- }
-
- /**
- * Builds an OpenstackPort object.
- *
- * @return OpenstackPort objecet
- */
- public OpenstackPort build() {
- return new OpenstackPort(status, name, allowedAddressPairs, adminStateUp,
- networkId, networkId, deviceOwner, macAddress, fixedIps,
- id, securityGroups, deviceId);
- }
- }
-}
-
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouter.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouter.java
deleted file mode 100644
index 5230c18..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouter.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright 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.
- * 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.Objects;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An Openstack Neutron Router Model.
- */
-public final class OpenstackRouter {
-
- public enum RouterStatus {
- UP,
- DOWN,
- ACTIVE,
- }
-
- private final String tenantId;
- private final String id;
- private final String name;
- private RouterStatus status;
- private boolean adminStateUp;
- private OpenstackExternalGateway gatewayExternalInfo;
-
- private OpenstackRouter(String id, String tenantId, String name, RouterStatus status,
- boolean adminStateUp, OpenstackExternalGateway gatewayExternalInfo) {
- this.id = id;
- this.tenantId = tenantId;
- this.name = name;
- this.status = status;
- this.adminStateUp = adminStateUp;
- this.gatewayExternalInfo = gatewayExternalInfo;
-
- }
-
- /**
- * Returns tenant ID.
- *
- * @return tenant ID
- */
- public String tenantId() {
- return tenantId;
- }
-
- /**
- * Returns router ID.
- *
- * @return router ID
- */
- public String id() {
- return id;
- }
-
- /**
- * Returns router name.
- *
- * @return router name
- */
- public String name() {
- return name;
- }
-
- /**
- * Returns router status.
- *
- * @return router stauts
- */
- public RouterStatus status() {
- return status;
- }
-
- /**
- * Returns whether admin state up or not.
- *
- * @return true if admin state up, false otherwise
- */
- public boolean adminStateUp() {
- return adminStateUp;
- }
-
- /**
- * Returns external gateway information.
- *
- * @return external gateway information
- */
- public OpenstackExternalGateway gatewayExternalInfo() {
- return gatewayExternalInfo;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (o instanceof OpenstackRouter) {
- OpenstackRouter that = (OpenstackRouter) o;
-
- return this.adminStateUp == that.adminStateUp &&
- this.gatewayExternalInfo.equals(that.gatewayExternalInfo) &&
- this.id.equals(that.id) &&
- this.name.equals(that.name) &&
- this.status.equals(that.status) &&
- this.tenantId.equals(that.tenantId);
- }
-
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(adminStateUp, gatewayExternalInfo, id, name, status, tenantId);
- }
-
- /**
- * An Openstack Router Builder class.
- */
- public static final class Builder {
-
- private String tenantId;
- private String id;
- private String name;
- private RouterStatus status;
- private Boolean adminStateUp;
- private OpenstackExternalGateway gatewayExternalInfo;
-
- /**
- * Sets router ID.
- *
- * @param id router ID
- * @return Builder object
- */
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Sets router name.
- *
- * @param name router name
- * @return Builder object
- */
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * Sets router status.
- *
- * @param status router status
- * @return Builder object
- */
- public Builder status(RouterStatus status) {
- this.status = status;
- return this;
- }
-
- /**
- * Sets tenant ID.
- *
- * @param tenantId Tenant ID
- * @return Builder object
- */
- public Builder tenantId(String tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- /**
- * Sets whether admin state up or not.
- *
- * @param adminStateUp true if admin state is up, false otherwise
- * @return Builder object
- */
- public Builder adminStateUp(boolean adminStateUp) {
- this.adminStateUp = adminStateUp;
- return this;
- }
-
- /**
- * Sets external gateway information.
- *
- * @param gatewayExternalInfo external gateway information
- * @return Builder object
- */
- public Builder gatewayExternalInfo(OpenstackExternalGateway gatewayExternalInfo) {
- this.gatewayExternalInfo = gatewayExternalInfo;
- return this;
- }
-
- /**
- * Builds an OpenstackRouter object.
- *
- * @return OpenstasckRouter object
- */
- public OpenstackRouter build() {
- return new OpenstackRouter(checkNotNull(id), checkNotNull(tenantId), name, checkNotNull(status),
- checkNotNull(adminStateUp), gatewayExternalInfo);
- }
- }
-
-
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouterInterface.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouterInterface.java
deleted file mode 100644
index 78ab815..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackRouterInterface.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 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.
- * 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.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An Openstack Neutron Router Interface Model.
- */
-public final class OpenstackRouterInterface {
- private final String id;
- private final String tenantId;
- private final String subnetId;
- private final String portId;
-
- private OpenstackRouterInterface(String id, String tenantId,
- String subnetId, String portId) {
- this.id = checkNotNull(id);
- this.tenantId = checkNotNull(tenantId);
- this.subnetId = checkNotNull(subnetId);
- this.portId = checkNotNull(portId);
- }
-
- /**
- * Returns Router Interface ID.
- *
- * @return router interface ID
- */
- public String id() {
- return id;
- }
-
- /**
- * Returns tenant ID.
- *
- * @return tenant ID
- */
- public String tenantId() {
- return tenantId;
- }
-
- /**
- * Returns subnet ID.
- *
- * @return subnet ID
- */
- public String subnetId() {
- return subnetId;
- }
-
- /**
- * Returns port ID.
- *
- * @return port ID
- */
- public String portId() {
- return portId;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (o instanceof OpenstackRouterInterface) {
- OpenstackRouterInterface that = (OpenstackRouterInterface) o;
-
- return this.id.equals(that.id) &&
- this.portId.equals(that.portId) &&
- this.subnetId.equals(that.subnetId) &&
- this.tenantId.equals(that.tenantId);
- }
-
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, portId, subnetId, tenantId);
- }
-
- /**
- * An Openstack Router Interface Builder class.
- */
- public static final class Builder {
- private String id;
- private String tenantId;
- private String subnetId;
- private String portId;
-
- /**
- * Sets Router Interface ID.
- *
- * @param id router interface ID
- * @return Builder object
- */
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Sets tenant ID.
- *
- * @param tenantId tenant ID
- * @return Builder object
- */
- public Builder tenantId(String tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- /**
- * Sets subnet ID.
- *
- * @param subnetId subnet ID
- * @return Builder object
- */
- public Builder subnetId(String subnetId) {
- this.subnetId = subnetId;
- return this;
- }
-
- /**
- * Sets port ID.
- *
- * @param portId port ID
- * @return Builder object
- */
- public Builder portId(String portId) {
- this.portId = portId;
- return this;
- }
-
- /**
- * Builds an Openstack Router Interface object.
- *
- * @return OpenstackRouterInterface object
- */
- public OpenstackRouterInterface build() {
- return new OpenstackRouterInterface(checkNotNull(id), checkNotNull(tenantId),
- checkNotNull(subnetId), checkNotNull(portId));
- }
-
- }
-}
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 101059a..c6627af 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
@@ -15,6 +15,10 @@
*/
package org.onosproject.openstacknetworking;
+import org.onosproject.openstackinterface.OpenstackFloatingIP;
+import org.onosproject.openstackinterface.OpenstackRouter;
+import org.onosproject.openstackinterface.OpenstackRouterInterface;
+
/**
* The Interface of Openstack Routing.
*/
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroup.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroup.java
deleted file mode 100644
index 358b92b..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroup.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright 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.
- * 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.Collection;
-import java.util.Collections;
-import java.util.Objects;
-
-/**
- * Represents Openstack Security Group information.
- */
-public final class OpenstackSecurityGroup {
-
- private String description;
- private String id;
- private String name;
- private Collection<OpenstackSecurityGroupRule> rules;
- private String tenantId;
-
- private OpenstackSecurityGroup(String description, String id, String name,
- Collection<OpenstackSecurityGroupRule> rules,
- String tenantId) {
- this.description = description;
- this.id = id;
- this.name = name;
- this.tenantId = tenantId;
- this.rules = rules;
- }
-
- /**
- * Returns the description of the security group.
- *
- * @return description
- */
- public String description() {
- return this.description;
- }
-
- /**
- * Returns ID of the security group.
- *
- * @return ID
- */
- public String id() {
- return this.id;
- }
-
- /**
- * Returns the name of the security group.
- *
- * @return name
- */
- public String name() {
- return this.name;
- }
-
- /**
- * Returns the list of the security group rules.
- *
- * @return Collection of OpenstackSecurityGroupRule objects
- */
- public Collection<OpenstackSecurityGroupRule> rules() {
- return Collections.unmodifiableCollection(rules);
- }
-
- /**
- * Returns the Tenant ID.
- *
- * @return tenant ID
- */
- public String tenantId() {
- return this.tenantId;
- }
-
- @Override
- public String toString() {
- StringBuilder sbuilder = new StringBuilder("Security Group :")
- .append(description + ",")
- .append(id + ",")
- .append(name + ",");
- rules.forEach(rule -> sbuilder.append(rule.toString()));
- sbuilder.append(tenantId);
-
- return sbuilder.toString();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o instanceof OpenstackSecurityGroup) {
- OpenstackSecurityGroup that = (OpenstackSecurityGroup) o;
-
- return this.description.equals(that.description) &&
- this.tenantId.equals(that.tenantId) &&
- this.id.equals(that.id) &&
- this.name.equals(that.name) &&
- this.rules.containsAll(that.rules);
- }
-
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(description, tenantId, id, name, rules);
- }
-
- /**
- * Returns the SecurityGroupRule builder object.
- *
- * @return builder object
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Represents the builder of the SecurityGroupRule.
- *
- */
- public static final class Builder {
- private String description;
- private String id;
- private String name;
- private Collection<OpenstackSecurityGroupRule> rules;
- private String tenantId;
-
- /**
- * Sets the description of the security group.
- *
- * @param description description
- * @return builder object
- */
- public Builder description(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * Sets the ID of the security group.
- *
- * @param id ID
- * @return builder object
- */
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Sets the name of the security group.
- *
- * @param name name
- * @return builder object
- */
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * Sets Security Group rules.
- *
- * @param rules security group rules
- * @return builder object
- */
- public Builder rules(Collection<OpenstackSecurityGroupRule> rules) {
- this.rules = rules;
- return this;
- }
-
- /**
- * Sets the tenant ID of the security group.
- *
- * @param tenantId tenant ID
- * @return builder object
- */
- public Builder tenantId(String tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- /**
- * Creates the OpenstackSecurityGroup object.
- *
- * @return OpenstackSecurityGroup object
- */
- public OpenstackSecurityGroup build() {
- return new OpenstackSecurityGroup(description, id, name, rules, tenantId);
- }
- }
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroupRule.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroupRule.java
deleted file mode 100644
index 8b9da8f..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSecurityGroupRule.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * 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.openstacknetworking;
-
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Represents Openstack Security Group Rules.
- */
-public final class OpenstackSecurityGroupRule {
-
- private final String direction;
- private final String ethertype;
- private final String id;
- private final String portRangeMax;
- private final String portRangeMin;
- private final String protocol;
- private final String remoteGroupId;
- private final String remoteIpPrefix;
- private final String secuityGroupId;
- private final String tenantId;
-
- private OpenstackSecurityGroupRule(String direction,
- String ethertype,
- String id,
- String portRangeMax,
- String portRangeMin,
- String protocol,
- String remoteGroupId,
- String remoteIpPrefix,
- String securityGroupId,
- String tenantId) {
- this.direction = direction;
- this.ethertype = ethertype;
- this.id = checkNotNull(id);
- this.portRangeMax = portRangeMax;
- this.portRangeMin = portRangeMin;
- this.protocol = protocol;
- this.remoteGroupId = remoteGroupId;
- this.remoteIpPrefix = remoteIpPrefix;
- this.secuityGroupId = securityGroupId;
- this.tenantId = tenantId;
- }
-
- @Override
- public String toString() {
- return new StringBuilder(" [")
- .append(direction + ",")
- .append(ethertype + ",")
- .append(id + ",")
- .append(portRangeMax + ",")
- .append(portRangeMin + ",")
- .append(protocol + ",'")
- .append(remoteGroupId + ",")
- .append(remoteIpPrefix + ",")
- .append(secuityGroupId + ",")
- .append(tenantId + "] ")
- .toString();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (this instanceof OpenstackSecurityGroupRule) {
- OpenstackSecurityGroupRule that = (OpenstackSecurityGroupRule) o;
- return this.direction.equals(that.direction) &&
- this.ethertype.equals(that.direction) &&
- this.id.equals(that.id) &&
- this.portRangeMax.equals(that.portRangeMax) &&
- this.portRangeMin.equals(that.portRangeMin) &&
- this.protocol.equals(that.protocol) &&
- this.remoteGroupId.equals(that.remoteGroupId) &&
- this.secuityGroupId.equals(that.secuityGroupId) &&
- this.remoteIpPrefix.equals(that.remoteIpPrefix) &&
- this.tenantId.equals(that.tenantId);
- }
-
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(direction, ethertype, id, portRangeMax, portRangeMin, protocol,
- remoteGroupId, remoteIpPrefix, secuityGroupId, tenantId);
- }
-
- /**
- * Represents a security group rule builder object.
- */
- public static final class Builder {
-
- private String direction;
- private String etherType;
- private String id;
- private String portRangeMax;
- private String portRangeMin;
- private String protocol;
- private String remoteGroupId;
- private String remoteIpPrefix;
- private String secuityGroupId;
- private String tenantId;
-
-
- /**
- * Sets the direction of the security group rule.
- *
- * @param direction direction (ingress or egress)
- * @return builder object
- */
- public Builder direction(String direction) {
- this.direction = direction;
- return this;
- }
-
- /**
- * Sets the Ethernet Type.
- *
- * @param etherType Ethernet Type
- * @return builder object
- */
- public Builder etherType(String etherType) {
- this.etherType = etherType;
- return this;
- }
-
- /**
- * Sets the Security Group Rule ID.
- *
- * @param id security group rule ID
- * @return builder object
- */
- public Builder id(String id) {
- this.id = id;
- return this;
- }
-
- /**
- * Sets the port range max value.
- *
- * @param portRangeMax port range max value
- * @return builder object
- */
- public Builder portRangeMax(String portRangeMax) {
- this.portRangeMax = portRangeMax;
- return this;
- }
-
- /**
- * Sets the port range min value.
- *
- * @param portRangeMin port range min value
- * @return builder object
- */
- public Builder portRangeMin(String portRangeMin) {
- this.portRangeMin = portRangeMin;
- return this;
- }
-
- /**
- * Sets the protocol.
- *
- * @param protocol protocol
- * @return builder object
- */
- public Builder protocol(String protocol) {
- this.protocol = protocol;
- return this;
- }
-
- /**
- * Sets the remote security group ID.
- *
- * @param remoteGroupId remote security group ID
- * @return builder
- */
- public Builder remoteGroupId(String remoteGroupId) {
- this.remoteGroupId = remoteGroupId;
- return this;
- }
-
- /**
- * Sets the remote IP address as prefix.
- *
- * @param remoteIpPrefix remote IP address
- * @return builder object
- */
- public Builder remoteIpPrefix(String remoteIpPrefix) {
- this.remoteIpPrefix = remoteIpPrefix;
- return this;
- }
-
- /**
- * Sets the Security Group ID.
- *
- * @param securityGroupId security group ID
- * @return builder object
- */
- public Builder securityGroupId(String securityGroupId) {
- this.secuityGroupId = securityGroupId;
- return this;
- }
-
- /**
- * Sets the tenant ID.
- *
- * @param tenantId tenant ID
- * @return builder object
- */
- public Builder tenantId(String tenantId) {
- this.tenantId = tenantId;
- return this;
- }
-
- /**
- * Creates a OpenstackSecurityGroupRule instance.
- *
- * @return OpenstackSecurityGroupRule object
- */
- public OpenstackSecurityGroupRule build() {
- return new OpenstackSecurityGroupRule(direction, etherType, id, portRangeMax,
- portRangeMin, protocol, remoteGroupId, remoteIpPrefix, secuityGroupId, tenantId);
- }
- }
-}
diff --git a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSubnet.java b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSubnet.java
deleted file mode 100644
index 8223711..0000000
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSubnet.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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.openstacknetworking;
-
-import org.onlab.packet.Ip4Address;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Represents the subnet information given by Neutron.
- *
- */
-public final class OpenstackSubnet {
- private String name;
- private boolean enableHhcp;
- private String networkId;
- private String tenantId;
- private List<Ip4Address> dnsNameservers;
- private String gatewayIp;
- private String cidr;
- private String id;
- private Collection<String> securityGroups;
-
- private OpenstackSubnet(String name, boolean enableHhcp, String networkId,
- String tenantId, List<Ip4Address> dnsNameservers, String gatewayIp,
- String cidr, String id, Collection<String> securityGroups) {
- this.name = name;
- this.enableHhcp = enableHhcp;
- this.networkId = checkNotNull(networkId);
- this.tenantId = checkNotNull(tenantId);
- this.dnsNameservers = dnsNameservers;
- this.gatewayIp = gatewayIp;
- this.cidr = checkNotNull(cidr);
- this.id = checkNotNull(id);
- this.securityGroups = securityGroups;
- }
-
- /**
- * Returns OpenstackSubnet builder object.
- *
- * @return OpenstackSubnet builder
- */
- public static OpenstackSubnet.Builder builder() {
- return new Builder();
- }
-
- public String name() {
- return name;
- }
-
- public boolean enableHhcp() {
- return enableHhcp;
- }
-
- public String networkId() {
- return networkId;
- }
-
- public String tenantId() {
- return tenantId;
- }
-
- public List<Ip4Address> dnsNameservers() {
- return dnsNameservers;
- }
-
- public String gatewayIp() {
- return gatewayIp;
- }
-
- public String cidr() {
- return cidr;
- }
-
- public String id() {
- return id;
- }
-
- public Collection<String> securityGroups() {
- return Collections.unmodifiableCollection(this.securityGroups);
- }
-
- /**
- * OpenstackSubnet Builder class.
- *
- */
- public static final class Builder {
- private String name;
- private boolean enableDhcp;
- private String networkId;
- private String tenantId;
- private List<Ip4Address> dnsNameservers;
- private String gatewayIp;
- private String cidr;
- private String id;
- private Collection<String> securityGroups;
-
- Builder() {}
-
- public Builder setName(String name) {
- this.name = name;
-
- return this;
- }
-
- public Builder setEnableDhcp(boolean enableDhcp) {
- this.enableDhcp = enableDhcp;
-
- return this;
- }
-
- public Builder setNetworkId(String networkId) {
- this.networkId = networkId;
-
- return this;
- }
-
- public Builder setTenantId(String tenantId) {
- this.tenantId = tenantId;
-
- return this;
- }
-
- public Builder setDnsNameservers(List<Ip4Address> dnsNameservers) {
- this.dnsNameservers = dnsNameservers;
-
- return this;
- }
-
- public Builder setGatewayIp(String gatewayIp) {
- this.gatewayIp = gatewayIp;
-
- return this;
- }
-
- public Builder setCidr(String cidr) {
- this.cidr = cidr;
-
- return this;
- }
-
- public Builder setId(String id) {
- this.id = id;
-
- return this;
- }
-
- public Builder securityGroups(Collection<String> securityGroups) {
- this.securityGroups = securityGroups;
-
- return this;
- }
-
- public OpenstackSubnet build() {
- return new OpenstackSubnet(name, enableDhcp, networkId, tenantId,
- dnsNameservers, gatewayIp, cidr, id, securityGroups);
- }
- }
-}
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
index 9f70a00..a826f98 100644
--- a/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSwitchingService.java
+++ b/apps/openstacknetworking/api/src/main/java/org/onosproject/openstacknetworking/OpenstackSwitchingService.java
@@ -15,6 +15,10 @@
*/
package org.onosproject.openstacknetworking;
+import org.onosproject.openstackinterface.OpenstackNetwork;
+import org.onosproject.openstackinterface.OpenstackPort;
+import org.onosproject.openstackinterface.OpenstackSubnet;
+
import java.util.Map;
/**