CORD-628 Refactored VTN service network and port API
- Removed direct use of Neutron data model and Neutron API
- Extended service network and service port API to have all network
information required for VTN
- Removed unnecessary dependency manager and store
- Removed network state sync method with Neutron and XOS
- Removed Neutron and XOS access information from the network config
- Re-organized API packages
Change-Id: I18f49ec733309315f683dfb2e6be6526056118f1
diff --git a/src/main/java/org/opencord/cordvtn/api/config/CordVtnConfig.java b/src/main/java/org/opencord/cordvtn/api/CordVtnConfig.java
similarity index 81%
rename from src/main/java/org/opencord/cordvtn/api/config/CordVtnConfig.java
rename to src/main/java/org/opencord/cordvtn/api/CordVtnConfig.java
index 7f5a102..aa90093 100644
--- a/src/main/java/org/opencord/cordvtn/api/config/CordVtnConfig.java
+++ b/src/main/java/org/opencord/cordvtn/api/CordVtnConfig.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordvtn.api.config;
+package org.opencord.cordvtn.api;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -31,8 +31,8 @@
import org.onosproject.net.behaviour.ControllerInfo;
import org.onosproject.net.config.Config;
import org.onosproject.net.config.InvalidFieldException;
+import org.opencord.cordvtn.api.net.CidrAddr;
import org.opencord.cordvtn.api.node.CordVtnNode;
-import org.opencord.cordvtn.api.node.NetworkAddress;
import org.opencord.cordvtn.api.node.SshAccessInfo;
import org.slf4j.Logger;
@@ -74,12 +74,10 @@
private static final String SSH_USER = "sshUser";
private static final String SSH_KEY_FILE = "sshKeyFile";
+ @Deprecated
private static final String OPENSTACK = "openstack";
+ @Deprecated
private static final String XOS = "xos";
- private static final String ENDPOINT = "endpoint";
- private static final String TENANT = "tenant";
- private static final String USER = "user";
- private static final String PASSWORD = "password";
private static final String CONTROLLERS = "controllers";
private static final int INDEX_IP = 0;
@@ -108,23 +106,23 @@
}
// check all mandatory fields are present and valid
- result &= isMacAddress(PRIVATE_GATEWAY_MAC, MANDATORY);
- result &= isIpPrefix(LOCAL_MANAGEMENT_IP, MANDATORY);
+ result = result && isMacAddress(PRIVATE_GATEWAY_MAC, MANDATORY);
+ result = result && isIpPrefix(LOCAL_MANAGEMENT_IP, MANDATORY);
for (JsonNode node : object.get(CORDVTN_NODES)) {
ObjectNode vtnNode = (ObjectNode) node;
- result &= hasFields(
+ result = result && hasFields(
vtnNode,
HOSTNAME,
HOST_MANAGEMENT_IP,
DATA_IP,
DATA_IFACE,
INTEGRATION_BRIDGE_ID);
- result &= isIpPrefix(vtnNode, HOST_MANAGEMENT_IP, MANDATORY);
- result &= isIpPrefix(vtnNode, DATA_IP, MANDATORY);
+ result = result && isIpPrefix(vtnNode, HOST_MANAGEMENT_IP, MANDATORY);
+ result = result && isIpPrefix(vtnNode, DATA_IP, MANDATORY);
- NetworkAddress localMgmt = NetworkAddress.valueOf(get(LOCAL_MANAGEMENT_IP, ""));
- NetworkAddress hostsMgmt = NetworkAddress.valueOf(getConfig(vtnNode, HOST_MANAGEMENT_IP));
+ CidrAddr localMgmt = CidrAddr.valueOf(get(LOCAL_MANAGEMENT_IP, ""));
+ CidrAddr hostsMgmt = CidrAddr.valueOf(getConfig(vtnNode, HOST_MANAGEMENT_IP));
if (hostsMgmt.prefix().contains(localMgmt.prefix()) ||
localMgmt.prefix().contains(hostsMgmt.prefix())) {
final String msg = "Host and local management network IP conflict";
@@ -132,43 +130,30 @@
}
}
- result &= hasFields(
+ result = result && hasFields(
(ObjectNode) object.get(SSH),
SSH_PORT,
SSH_USER,
SSH_KEY_FILE);
- result &= isTpPort(
+ result = result && isTpPort(
(ObjectNode) object.get(SSH),
SSH_PORT,
MANDATORY);
- result &= hasFields(
- (ObjectNode) object.get(OPENSTACK),
- ENDPOINT,
- TENANT,
- USER,
- PASSWORD);
-
- result &= hasFields(
- (ObjectNode) object.get(XOS),
- ENDPOINT,
- USER,
- PASSWORD);
-
// check all optional fields are valid
- result &= isTpPort(OVSDB_PORT, OPTIONAL);
+ result = result && isTpPort(OVSDB_PORT, OPTIONAL);
if (object.get(PUBLIC_GATEWAYS) != null && object.get(PUBLIC_GATEWAYS).isArray()) {
for (JsonNode node : object.get(PUBLIC_GATEWAYS)) {
ObjectNode gateway = (ObjectNode) node;
- result &= isIpAddress(gateway, GATEWAY_IP, MANDATORY);
- result &= isMacAddress(gateway, GATEWAY_MAC, MANDATORY);
+ result = result && isIpAddress(gateway, GATEWAY_IP, MANDATORY);
+ result = result && isMacAddress(gateway, GATEWAY_MAC, MANDATORY);
}
}
if (object.get(CONTROLLERS) != null) {
for (JsonNode jsonNode : object.get(CONTROLLERS)) {
- result &= isController(jsonNode);
+ result = result && isController(jsonNode);
}
}
return result;
@@ -211,8 +196,8 @@
String ovsdbPort = getConfig(object, OVSDB_PORT);
object.get(CORDVTN_NODES).forEach(vtnNode -> {
- NetworkAddress localMgmt = NetworkAddress.valueOf(get(LOCAL_MANAGEMENT_IP, ""));
- NetworkAddress hostsMgmt = NetworkAddress.valueOf(getConfig(vtnNode, HOST_MANAGEMENT_IP));
+ CidrAddr localMgmt = CidrAddr.valueOf(get(LOCAL_MANAGEMENT_IP, ""));
+ CidrAddr hostsMgmt = CidrAddr.valueOf(getConfig(vtnNode, HOST_MANAGEMENT_IP));
SshAccessInfo sshInfo = new SshAccessInfo(
hostsMgmt.ip().getIp4Address(),
@@ -286,31 +271,6 @@
}
/**
- * Returns XOS API endpoint and credential configuration.
- *
- * @return xos api configuration
- */
- public XosConfig xosConfig() {
- JsonNode jsonNode = object.get(XOS);
- return new XosConfig(getConfig(jsonNode, ENDPOINT),
- getConfig(jsonNode, USER),
- getConfig(jsonNode, PASSWORD));
- }
-
- /**
- * Returns OpenStack API endpoint and credential configuration.
- *
- * @return openstack api configuration
- */
- public OpenStackConfig openStackConfig() {
- JsonNode jsonNode = object.get(OPENSTACK);
- return new OpenStackConfig(jsonNode.path(ENDPOINT).asText(),
- jsonNode.path(TENANT).asText(),
- jsonNode.path(USER).asText(),
- jsonNode.path(PASSWORD).asText());
- }
-
- /**
* Returns controllers for the integration bridge.
* It returns the information taken from cluster service with the default OF
* port if no controller is specified in the network config.
diff --git a/src/main/java/org/opencord/cordvtn/api/config/AbstractApiConfig.java b/src/main/java/org/opencord/cordvtn/api/config/AbstractApiConfig.java
deleted file mode 100644
index ffac44f..0000000
--- a/src/main/java/org/opencord/cordvtn/api/config/AbstractApiConfig.java
+++ /dev/null
@@ -1,100 +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.opencord.cordvtn.api.config;
-
-import com.google.common.base.MoreObjects;
-
-import java.util.Objects;
-
-/**
- * Representation of external API access configuration.
- */
-public abstract class AbstractApiConfig {
-
- protected final String endpoint;
- protected final String user;
- protected final String password;
-
- /**
- * Default constructor.
- *
- * @param endpoint api endpoint
- * @param user user name
- * @param password password of the user
- */
- protected AbstractApiConfig(String endpoint, String user, String password) {
- this.endpoint = endpoint;
- this.user = user;
- this.password = password;
- }
-
- /**
- * Returns the endpoint.
- *
- * @return endpoint
- */
- public String endpoint() {
- return endpoint;
- }
-
- /**
- * Returns the user.
- *
- * @return user
- */
- public String user() {
- return user;
- }
-
- /**
- * Returns the password.
- *
- * @return password
- */
- public String password() {
- return password;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(endpoint, user, password);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if ((obj instanceof AbstractApiConfig)) {
- AbstractApiConfig that = (AbstractApiConfig) obj;
- if (Objects.equals(endpoint, that.endpoint) &&
- Objects.equals(user, that.user) &&
- Objects.equals(password, that.password)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("endpoint", endpoint)
- .add("user", user)
- .add("password", password)
- .toString();
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/config/OpenStackConfig.java b/src/main/java/org/opencord/cordvtn/api/config/OpenStackConfig.java
deleted file mode 100644
index 913b5e8..0000000
--- a/src/main/java/org/opencord/cordvtn/api/config/OpenStackConfig.java
+++ /dev/null
@@ -1,83 +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.opencord.cordvtn.api.config;
-
-import com.google.common.base.MoreObjects;
-
-import java.util.Objects;
-
-/**
- * Representation of OpenStack API access configuration.
- */
-public final class OpenStackConfig extends AbstractApiConfig {
-
- private final String tenant;
-
- /**
- * Default constructor.
- *
- * @param endpoint api endpoint
- * @param tenant tenant name
- * @param user user name
- * @param password password of the user
- */
- public OpenStackConfig(String endpoint, String tenant, String user,
- String password) {
- super(endpoint, user, password);
- this.tenant = tenant;
- }
-
- /**
- * Returns the tenant name.
- *
- * @return tenant name
- */
- public String tenant() {
- return tenant;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(endpoint, tenant, user, password);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if ((obj instanceof OpenStackConfig)) {
- OpenStackConfig that = (OpenStackConfig) obj;
- if (Objects.equals(endpoint, that.endpoint) &&
- Objects.equals(tenant, that.tenant) &&
- Objects.equals(user, that.user) &&
- Objects.equals(password, that.password)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("endpoint", endpoint)
- .add("tenant", tenant)
- .add("user", user)
- .add("password", password)
- .toString();
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/config/XosConfig.java b/src/main/java/org/opencord/cordvtn/api/config/XosConfig.java
deleted file mode 100644
index b2387a6..0000000
--- a/src/main/java/org/opencord/cordvtn/api/config/XosConfig.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.opencord.cordvtn.api.config;
-
-/**
- * Representation of XOS API access configuration.
- */
-public final class XosConfig extends AbstractApiConfig {
-
- /**
- * Default constructor.
- *
- * @param endpoint api endpoint
- * @param user user name
- * @param password password of the user
- */
- public XosConfig(String endpoint, String user, String password) {
- super(endpoint, user, password);
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/config/package-info.java b/src/main/java/org/opencord/cordvtn/api/config/package-info.java
deleted file mode 100644
index b4fa066..0000000
--- a/src/main/java/org/opencord/cordvtn/api/config/package-info.java
+++ /dev/null
@@ -1,20 +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.
- */
-
-/**
- * CORD VTN configuration API definitions.
- */
-package org.opencord.cordvtn.api.config;
\ No newline at end of file
diff --git a/src/main/java/org/opencord/cordvtn/api/core/CordVtnAdminService.java b/src/main/java/org/opencord/cordvtn/api/core/CordVtnAdminService.java
deleted file mode 100644
index 2411628..0000000
--- a/src/main/java/org/opencord/cordvtn/api/core/CordVtnAdminService.java
+++ /dev/null
@@ -1,150 +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.opencord.cordvtn.api.core;
-
-import org.opencord.cordvtn.api.net.NetworkId;
-import org.opencord.cordvtn.api.net.NetworkService;
-import org.opencord.cordvtn.api.net.PortId;
-import org.opencord.cordvtn.api.net.ServiceNetwork;
-import org.opencord.cordvtn.api.net.ServiceNetworkService;
-import org.opencord.cordvtn.api.net.ServicePort;
-import org.opencord.cordvtn.api.net.SubnetId;
-import org.openstack4j.model.network.Network;
-import org.openstack4j.model.network.Port;
-import org.openstack4j.model.network.Subnet;
-
-/**
- * Service for administering the inventory of {@link Network} and
- * {@link ServiceNetwork}.
- */
-public interface CordVtnAdminService extends CordVtnService, NetworkService,
- ServiceNetworkService {
-
- /**
- * Purges internal network states.
- */
- void purgeStates();
-
- /**
- * Synchronizes internal network states with external services.
- */
- void syncStates();
-
- /**
- * Creates a service port with the given information.
- *
- * @param servicePort the new service port
- */
- void createServicePort(ServicePort servicePort);
-
- /**
- * Updates a service port with the given information.
- *
- * @param servicePort the updated service port
- */
- void updateServicePort(ServicePort servicePort);
-
- /**
- * Removes a service port with the given port id.
- *
- * @param portId port id
- */
- void removeServicePort(PortId portId);
-
- /**
- * Creates a service network with the given information.
- *
- * @param serviceNet the new service network
- */
- void createServiceNetwork(ServiceNetwork serviceNet);
-
- /**
- * Updates a service network with the given information.
- *
- * @param serviceNet the updated service network
- */
- void updateServiceNetwork(ServiceNetwork serviceNet);
-
- /**
- * Removes a service network with the given network id.
- *
- * @param netId network id
- */
- void removeServiceNetwork(NetworkId netId);
-
- /**
- * Creates a port.
- *
- * @param port port
- */
- void createPort(Port port);
-
- /**
- * Updates the port.
- *
- * @param port the updated port
- */
- void updatePort(Port port);
-
- /**
- * Removes the port with the given port id.
- *
- * @param portId port id
- */
- void removePort(PortId portId);
-
- /**
- * Creates a network.
- *
- * @param network network
- */
- void createNetwork(Network network);
-
- /**
- * Updates the network.
- *
- * @param network the updated network
- */
- void updateNetwork(Network network);
-
- /**
- * Removes the network with the given network id.
- *
- * @param netId network id
- */
- void removeNetwork(NetworkId netId);
-
- /**
- * Creates a subnet.
- *
- * @param subnet subnet id
- */
- void createSubnet(Subnet subnet);
-
- /**
- * Updates the subnet.
- *
- * @param subnet the updated subnet
- */
- void updateSubnet(Subnet subnet);
-
- /**
- * Removes the subnet with the given subnet id.
- *
- * @param subnetId subnet id
- */
- void removeSubnet(SubnetId subnetId);
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/core/CordVtnService.java b/src/main/java/org/opencord/cordvtn/api/core/CordVtnService.java
deleted file mode 100644
index 6f5e55e..0000000
--- a/src/main/java/org/opencord/cordvtn/api/core/CordVtnService.java
+++ /dev/null
@@ -1,72 +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.opencord.cordvtn.api.core;
-
-import org.onosproject.event.ListenerService;
-import org.opencord.cordvtn.api.net.NetworkId;
-import org.opencord.cordvtn.api.net.PortId;
-import org.opencord.cordvtn.api.net.VtnNetwork;
-import org.opencord.cordvtn.api.net.VtnNetworkEvent;
-import org.opencord.cordvtn.api.net.VtnNetworkListener;
-import org.opencord.cordvtn.api.net.VtnPort;
-
-import java.util.Set;
-
-/**
- * Service for interacting with the inventory of {@link VtnNetwork} and
- * {@link VtnPort}.
- */
-public interface CordVtnService
- extends ListenerService<VtnNetworkEvent, VtnNetworkListener> {
-
- /**
- * Returns the VTN port with the given port id.
- *
- * @param portId port id
- * @return service port
- */
- VtnPort vtnPort(PortId portId);
-
- /**
- * Returns the VTN port with the given port name.
- *
- * @param portName port name
- * @return vtn port
- */
- VtnPort vtnPort(String portName);
-
- /**
- * Returns all VTN ports.
- *
- * @return set of service ports
- */
- Set<VtnPort> vtnPorts();
-
- /**
- * Returns the VTN network with the given network id.
- *
- * @param netId network id
- * @return service network
- */
- VtnNetwork vtnNetwork(NetworkId netId);
-
- /**
- * Returns all VTN networks.
- *
- * @return set of service networks
- */
- Set<VtnNetwork> vtnNetworks();
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/core/CordVtnStore.java b/src/main/java/org/opencord/cordvtn/api/core/CordVtnStore.java
deleted file mode 100644
index 78a60a4..0000000
--- a/src/main/java/org/opencord/cordvtn/api/core/CordVtnStore.java
+++ /dev/null
@@ -1,220 +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.opencord.cordvtn.api.core;
-
-import org.onosproject.store.Store;
-import org.opencord.cordvtn.api.net.NetworkId;
-import org.opencord.cordvtn.api.net.PortId;
-import org.opencord.cordvtn.api.net.SubnetId;
-import org.opencord.cordvtn.api.net.VtnNetwork;
-import org.opencord.cordvtn.api.net.VtnNetworkEvent;
-import org.opencord.cordvtn.api.net.VtnPort;
-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 virtual and vtn networks; not intended for direct use.
- */
-public interface CordVtnStore extends Store<VtnNetworkEvent, CordVtnStoreDelegate> {
-
- /**
- * Purges vtn store.
- */
- void clear();
-
- /**
- * Creates vtn network.
- *
- * @param vtnNet vtn network
- */
- void createVtnNetwork(VtnNetwork vtnNet);
-
- /**
- * Updates the vtn network.
- *
- * @param vtnNet vtn network
- */
- void updateVtnNetwork(VtnNetwork vtnNet);
-
- /**
- * Returns the vtn network with the given network id.
- *
- * @param netId network id
- * @return vtn network
- */
- VtnNetwork vtnNetwork(NetworkId netId);
-
- /**
- * Returns all vtn networks.
- *
- * @return set of vtn networks
- */
- Set<VtnNetwork> vtnNetworks();
-
- /**
- * Removes the vtn network with the given network id.
- *
- * @param netId network id
- */
- void removeVtnNetwork(NetworkId netId);
-
- /**
- * Creates vtn port.
- *
- * @param vtnPort the new vtn port
- */
- void createVtnPort(VtnPort vtnPort);
-
- /**
- * Updates the vtn port.
- *
- * @param vtnPort vtn port
- */
- void updateVtnPort(VtnPort vtnPort);
-
- /**
- * Returns the vtn port with the given port id.
- *
- * @param portId port id
- * @return vtn port
- */
- VtnPort vtnPort(PortId portId);
-
- /**
- * Returns all vtn ports.
- *
- * @return set of vtn ports
- */
- Set<VtnPort> vtnPorts();
-
- /**
- * Removes vtn port.
- *
- * @param portId port id
- */
- void removeVtnPort(PortId portId);
-
- /**
- * Creates a network.
- *
- * @param net network
- */
- void createNetwork(Network net);
-
- /**
- * Updates the network.
- *
- * @param net the updated network
- */
- void updateNetwork(Network net);
-
- /**
- * Returns the network with the given network id.
- *
- * @param netId network id
- * @return network
- */
- Network network(NetworkId netId);
-
- /**
- * Returns all networks.
- *
- * @return set of networks
- */
- Set<Network> networks();
-
- /**
- * Removes the network with the given network id.
- *
- * @param netId network id
- */
- void removeNetwork(NetworkId netId);
-
- /**
- * Creates a port.
- *
- * @param port port
- */
- void createPort(Port port);
-
- /**
- * Updates the port.
- *
- * @param port the updated port
- */
- void updatePort(Port port);
-
- /**
- * Returns the port with the given port id.
- *
- * @param portId port id
- * @return port
- */
- Port port(PortId portId);
-
- /**
- * Returns all ports.
- *
- * @return set of ports
- */
- Set<Port> ports();
-
- /**
- * Removes the port with the given port id.
- *
- * @param portId port id
- */
- void removePort(PortId portId);
-
- /**
- * Creates a subnet.
- *
- * @param subnet subnet id
- */
- void createSubnet(Subnet subnet);
-
- /**
- * Updates the subnet.
- *
- * @param subnet the updated subnet
- */
- void updateSubnet(Subnet subnet);
-
- /**
- * Returns the subnet with the given subnet id.
- *
- * @param subnetId subnet id
- * @return subnet
- */
- Subnet subnet(SubnetId subnetId);
-
- /**
- * Returns all subnets.
- *
- * @return set of subnets
- */
- Set<Subnet> subnets();
-
- /**
- * Removes the subnet with the given subnet id.
- *
- * @param subnetId subnet id
- */
- void removeSubnet(SubnetId subnetId);
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/instance/Instance.java b/src/main/java/org/opencord/cordvtn/api/core/Instance.java
similarity index 95%
rename from src/main/java/org/opencord/cordvtn/api/instance/Instance.java
rename to src/main/java/org/opencord/cordvtn/api/core/Instance.java
index 79e478f..24c81b5 100644
--- a/src/main/java/org/opencord/cordvtn/api/instance/Instance.java
+++ b/src/main/java/org/opencord/cordvtn/api/core/Instance.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordvtn.api.instance;
+package org.opencord.cordvtn.api.core;
import com.google.common.base.Strings;
import org.onlab.packet.Ip4Address;
@@ -23,7 +23,7 @@
import org.onosproject.net.PortNumber;
import org.opencord.cordvtn.api.net.NetworkId;
import org.opencord.cordvtn.api.net.PortId;
-import org.opencord.cordvtn.api.net.ServiceNetwork.ServiceNetworkType;
+import org.opencord.cordvtn.api.net.ServiceNetwork.NetworkType;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -91,9 +91,9 @@
*
* @return network type
*/
- public ServiceNetworkType netType() {
+ public NetworkType netType() {
String netType = host.annotations().value(NETWORK_TYPE);
- return ServiceNetworkType.valueOf(netType);
+ return NetworkType.valueOf(netType);
}
/**
diff --git a/src/main/java/org/opencord/cordvtn/api/instance/InstanceHandler.java b/src/main/java/org/opencord/cordvtn/api/core/InstanceHandler.java
similarity index 96%
rename from src/main/java/org/opencord/cordvtn/api/instance/InstanceHandler.java
rename to src/main/java/org/opencord/cordvtn/api/core/InstanceHandler.java
index 6e1cdc9..bc06992 100644
--- a/src/main/java/org/opencord/cordvtn/api/instance/InstanceHandler.java
+++ b/src/main/java/org/opencord/cordvtn/api/core/InstanceHandler.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordvtn.api.instance;
+package org.opencord.cordvtn.api.core;
/**
* Handles service instance detection and removal.
diff --git a/src/main/java/org/opencord/cordvtn/api/instance/InstanceService.java b/src/main/java/org/opencord/cordvtn/api/core/InstanceService.java
similarity index 96%
rename from src/main/java/org/opencord/cordvtn/api/instance/InstanceService.java
rename to src/main/java/org/opencord/cordvtn/api/core/InstanceService.java
index 4d3ccca..c8eb5ef 100644
--- a/src/main/java/org/opencord/cordvtn/api/instance/InstanceService.java
+++ b/src/main/java/org/opencord/cordvtn/api/core/InstanceService.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordvtn.api.instance;
+package org.opencord.cordvtn.api.core;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.HostId;
@@ -24,6 +24,8 @@
*/
public interface InstanceService {
+ // TODO add get instance
+
/**
* Adds a service instance on a given connect point. Or updates if the
* instance already exists.
diff --git a/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkAdminService.java b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkAdminService.java
new file mode 100644
index 0000000..55edc53
--- /dev/null
+++ b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkAdminService.java
@@ -0,0 +1,74 @@
+/*
+ * 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.opencord.cordvtn.api.core;
+
+import org.opencord.cordvtn.api.net.NetworkId;
+import org.opencord.cordvtn.api.net.PortId;
+import org.opencord.cordvtn.api.net.ServiceNetwork;
+import org.opencord.cordvtn.api.net.ServicePort;
+
+/**
+ * Service for administering the inventory of {@link ServiceNetwork}.
+ */
+public interface ServiceNetworkAdminService extends ServiceNetworkService {
+
+ /**
+ * Purges internal network states.
+ */
+ void purgeStates();
+
+ /**
+ * Creates a service network with the given information.
+ *
+ * @param serviceNetwork the new service network
+ */
+ void createServiceNetwork(ServiceNetwork serviceNetwork);
+
+ /**
+ * Updates a service network with the given information.
+ *
+ * @param serviceNetwork the updated service network
+ */
+ void updateServiceNetwork(ServiceNetwork serviceNetwork);
+
+ /**
+ * Removes a service network with the given network id.
+ *
+ * @param networkId network id
+ */
+ void removeServiceNetwork(NetworkId networkId);
+
+ /**
+ * Creates a service port with the given information.
+ *
+ * @param servicePort the new service port
+ */
+ void createServicePort(ServicePort servicePort);
+
+ /**
+ * Updates a service port with the given information.
+ *
+ * @param servicePort the updated service port
+ */
+ void updateServicePort(ServicePort servicePort);
+
+ /**
+ * Removes a service port with the given port id.
+ *
+ * @param portId port id
+ */
+ void removeServicePort(PortId portId);
+}
diff --git a/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkEvent.java b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkEvent.java
new file mode 100644
index 0000000..5392ba0
--- /dev/null
+++ b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkEvent.java
@@ -0,0 +1,152 @@
+/*
+ * 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.opencord.cordvtn.api.core;
+
+import org.joda.time.LocalDateTime;
+import org.onosproject.event.AbstractEvent;
+import org.opencord.cordvtn.api.net.Provider;
+import org.opencord.cordvtn.api.net.ServiceNetwork;
+import org.opencord.cordvtn.api.net.ServicePort;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+
+/**
+ * Describes service network event.
+ */
+public class ServiceNetworkEvent extends AbstractEvent<ServiceNetworkEvent.Type, ServiceNetwork> {
+
+ private final ServicePort servicePort;
+ private final Provider provider;
+
+ /**
+ * Type of service network event.
+ */
+ public enum Type {
+ /**
+ * Signifies that a new service network has been created.
+ */
+ SERVICE_NETWORK_CREATED,
+
+ /**
+ * Signifies that some service network attributes have changed.
+ */
+ SERVICE_NETWORK_UPDATED,
+
+ /**
+ * Signifies that provider network was added.
+ */
+ SERVICE_NETWORK_PROVIDER_ADDED,
+
+ /**
+ * Signifies that provider network was removed.
+ */
+ SERVICE_NETWORK_PROVIDER_REMOVED,
+
+ /**
+ * Signifies that a service network has been removed.
+ */
+ SERVICE_NETWORK_REMOVED,
+
+ /**
+ * Signifies that a new service port has been created.
+ */
+ SERVICE_PORT_CREATED,
+
+ /**
+ * Signifies that some service port attributes have changed.
+ */
+ SERVICE_PORT_UPDATED,
+
+ /**
+ * Signifies that a service port has been removed.
+ */
+ SERVICE_PORT_REMOVED
+ }
+
+ /**
+ * Creates an event of a given type and for the specified service network and
+ * the current time.
+ *
+ * @param type service network event type
+ * @param serviceNetwork service network subject
+ */
+ public ServiceNetworkEvent(Type type, ServiceNetwork serviceNetwork) {
+ super(type, serviceNetwork);
+ this.servicePort = null;
+ this.provider = null;
+ }
+
+ /**
+ * Creates an event of a given type and for the specified service network,
+ * port and the current time.
+ *
+ * @param type service network event type
+ * @param serviceNetwork service network subject
+ * @param servicePort optional service port subject
+ */
+ public ServiceNetworkEvent(Type type, ServiceNetwork serviceNetwork, ServicePort servicePort) {
+ super(type, serviceNetwork);
+ this.servicePort = servicePort;
+ this.provider = null;
+ }
+
+ /**
+ * Creates an event of a given type and for the specified service network,
+ * provider, dependency type with the provider, and the current time.
+ *
+ * @param type service network event type
+ * @param serviceNetwork service network subject
+ * @param provider optional provider network
+ */
+ public ServiceNetworkEvent(Type type, ServiceNetwork serviceNetwork, Provider provider) {
+ super(type, serviceNetwork);
+ this.servicePort = null;
+ this.provider = provider;
+ }
+
+ /**
+ * Returns the service port subject.
+ * It returns valid value only with the service port events.
+ *
+ * @return service port; null if the event is not service port specific
+ */
+ public ServicePort servicePort() {
+ return servicePort;
+ }
+
+ /**
+ * Returns the provider of the service network.
+ *
+ * @return provider network; null if the event is not provider specific
+ */
+ public Provider provider() {
+ return provider;
+ }
+
+ @Override
+ public String toString() {
+ if (servicePort == null) {
+ return super.toString();
+ }
+ return toStringHelper(this)
+ .add("time", new LocalDateTime(time()))
+ .add("type", type())
+ .add("serviceNetwork", subject())
+ .add("servicePort", servicePort)
+ .add("provider", provider)
+ .toString();
+ }
+}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/VtnNetworkListener.java b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkListener.java
similarity index 80%
rename from src/main/java/org/opencord/cordvtn/api/net/VtnNetworkListener.java
rename to src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkListener.java
index 62cf834..dc8782c 100644
--- a/src/main/java/org/opencord/cordvtn/api/net/VtnNetworkListener.java
+++ b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkListener.java
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordvtn.api.net;
+package org.opencord.cordvtn.api.core;
import org.onosproject.event.EventListener;
/**
- * Listener for vtn network event.
+ * Listener for service network event.
*/
-public interface VtnNetworkListener extends EventListener<VtnNetworkEvent> {
+public interface ServiceNetworkListener extends EventListener<ServiceNetworkEvent> {
}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/ServiceNetworkService.java b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkService.java
similarity index 66%
rename from src/main/java/org/opencord/cordvtn/api/net/ServiceNetworkService.java
rename to src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkService.java
index 173f723..4217df0 100644
--- a/src/main/java/org/opencord/cordvtn/api/net/ServiceNetworkService.java
+++ b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkService.java
@@ -13,7 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordvtn.api.net;
+package org.opencord.cordvtn.api.core;
+
+import org.onosproject.event.ListenerService;
+import org.opencord.cordvtn.api.net.NetworkId;
+import org.opencord.cordvtn.api.net.PortId;
+import org.opencord.cordvtn.api.net.ServiceNetwork;
+import org.opencord.cordvtn.api.net.ServicePort;
import java.util.Set;
@@ -21,15 +27,16 @@
* Service for interacting with the inventory of {@link ServiceNetwork} and
* {@link ServicePort}.
*/
-public interface ServiceNetworkService {
+public interface ServiceNetworkService
+ extends ListenerService<ServiceNetworkEvent, ServiceNetworkListener> {
/**
* Returns the service network with the supplied network ID.
*
- * @param netId network id
+ * @param networkId network id
* @return service network
*/
- ServiceNetwork serviceNetwork(NetworkId netId);
+ ServiceNetwork serviceNetwork(NetworkId networkId);
/**
* Returns all service networks registered in the service.
@@ -52,4 +59,11 @@
* @return set of service ports
*/
Set<ServicePort> servicePorts();
+
+ /**
+ * Returns all service ports associated with the supplied network.
+ * @param networkId network id
+ * @return set of service ports
+ */
+ Set<ServicePort> servicePorts(NetworkId networkId);
}
diff --git a/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkStore.java b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkStore.java
new file mode 100644
index 0000000..536a9c5
--- /dev/null
+++ b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkStore.java
@@ -0,0 +1,108 @@
+/*
+ * 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.opencord.cordvtn.api.core;
+
+import org.onosproject.store.Store;
+import org.opencord.cordvtn.api.net.NetworkId;
+import org.opencord.cordvtn.api.net.PortId;
+import org.opencord.cordvtn.api.net.ServiceNetwork;
+import org.opencord.cordvtn.api.net.ServicePort;
+
+import java.util.Set;
+
+/**
+ * Manages inventory of service networks; not intended for direct use.
+ */
+public interface ServiceNetworkStore extends Store<ServiceNetworkEvent, ServiceNetworkStoreDelegate> {
+
+ /**
+ * Purges the service network store.
+ */
+ void clear();
+
+ /**
+ * Creates new service network.
+ *
+ * @param serviceNetwork service network
+ */
+ void createServiceNetwork(ServiceNetwork serviceNetwork);
+
+ /**
+ * Updates the service network.
+ *
+ * @param serviceNetwork service network
+ */
+ void updateServiceNetwork(ServiceNetwork serviceNetwork);
+
+ /**
+ * Returns the service network with the given network id.
+ *
+ * @param networkId network id
+ * @return service network
+ */
+ ServiceNetwork serviceNetwork(NetworkId networkId);
+
+ /**
+ * Returns all service networks.
+ *
+ * @return set of service networks
+ */
+ Set<ServiceNetwork> serviceNetworks();
+
+ /**
+ * Removes the service network with the given network id.
+ *
+ * @param networkId network id
+ * @return service network removed; null if failed
+ */
+ ServiceNetwork removeServiceNetwork(NetworkId networkId);
+
+ /**
+ * Creates service port.
+ *
+ * @param servicePort the new service port
+ */
+ void createServicePort(ServicePort servicePort);
+
+ /**
+ * Updates the service port.
+ *
+ * @param servicePort service port
+ */
+ void updateServicePort(ServicePort servicePort);
+
+ /**
+ * Returns the service port with the given port id.
+ *
+ * @param portId port id
+ * @return service port
+ */
+ ServicePort servicePort(PortId portId);
+
+ /**
+ * Returns all service ports.
+ *
+ * @return set of service ports
+ */
+ Set<ServicePort> servicePorts();
+
+ /**
+ * Removes service port.
+ *
+ * @param portId port id
+ */
+ ServicePort removeServicePort(PortId portId);
+}
diff --git a/src/main/java/org/opencord/cordvtn/api/core/CordVtnStoreDelegate.java b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkStoreDelegate.java
similarity index 84%
rename from src/main/java/org/opencord/cordvtn/api/core/CordVtnStoreDelegate.java
rename to src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkStoreDelegate.java
index d5d7b91..c1ff606 100644
--- a/src/main/java/org/opencord/cordvtn/api/core/CordVtnStoreDelegate.java
+++ b/src/main/java/org/opencord/cordvtn/api/core/ServiceNetworkStoreDelegate.java
@@ -16,10 +16,9 @@
package org.opencord.cordvtn.api.core;
import org.onosproject.store.StoreDelegate;
-import org.opencord.cordvtn.api.net.VtnNetworkEvent;
/**
* VTN store delegate abstraction.
*/
-public interface CordVtnStoreDelegate extends StoreDelegate<VtnNetworkEvent> {
+public interface ServiceNetworkStoreDelegate extends StoreDelegate<ServiceNetworkEvent> {
}
diff --git a/src/main/java/org/opencord/cordvtn/api/dependency/Dependency.java b/src/main/java/org/opencord/cordvtn/api/dependency/Dependency.java
deleted file mode 100644
index 775fb16..0000000
--- a/src/main/java/org/opencord/cordvtn/api/dependency/Dependency.java
+++ /dev/null
@@ -1,169 +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.opencord.cordvtn.api.dependency;
-
-import com.google.common.base.MoreObjects;
-import org.opencord.cordvtn.api.net.VtnNetwork;
-
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Representation of a dependency between two networks, subscriber and provider.
- */
-public final class Dependency {
-
- public enum Type {
- BIDIRECTIONAL,
- UNIDIRECTIONAL
- }
-
- private final VtnNetwork subscriber;
- private final VtnNetwork provider;
- private final Type type;
-
- private Dependency(VtnNetwork subscriber, VtnNetwork provider, Type type) {
- this.subscriber = subscriber;
- this.provider = provider;
- this.type = type;
- }
-
- /**
- * Returns subscriber network.
- *
- * @return vtn network
- */
- public VtnNetwork subscriber() {
- return subscriber;
- }
-
- /**
- * Returns provider network.
- *
- * @return vtn network
- */
- public VtnNetwork provider() {
- return provider;
- }
-
- /**
- * Returns direct access type between subscriber and provider networks.
- *
- * @return type
- */
- public Type type() {
- return type;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof Dependency) {
- Dependency that = (Dependency) obj;
- if (Objects.equals(subscriber, that.subscriber) &&
- Objects.equals(provider, that.provider) &&
- Objects.equals(type, that.type)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(subscriber, provider, type);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("subscriber", subscriber.id())
- .add("provider", provider.id())
- .add("type", type)
- .toString();
- }
-
- /**
- * Returns new dependency builder instance.
- *
- * @return dependency
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of the dependency entities.
- */
- public static final class Builder {
- private VtnNetwork subscriber;
- private VtnNetwork provider;
- private Type type;
-
- private Builder() {
- }
-
- /**
- * Builds an immutable dependency.
- *
- * @return dependency instance
- */
- public Dependency build() {
- checkNotNull(subscriber);
- checkNotNull(provider);
- checkNotNull(type);
-
- return new Dependency(subscriber, provider, type);
- }
-
- /**
- * Returns dependency with the supplied subscriber.
- *
- * @param subscriber subscriber network
- * @return dependency builder
- */
- public Builder subscriber(VtnNetwork subscriber) {
- this.subscriber = subscriber;
- return this;
- }
-
- /**
- * Returns dependency with the supplied provider.
- *
- * @param provider provider network
- * @return dependency builder
- */
- public Builder provider(VtnNetwork provider) {
- this.provider = provider;
- return this;
- }
-
- /**
- * Returns dependency with the supplied type.
- *
- * @param type type
- * @return dependency builder
- */
- public Builder type(Type type) {
- this.type = type;
- return this;
- }
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/dependency/DependencyService.java b/src/main/java/org/opencord/cordvtn/api/dependency/DependencyService.java
deleted file mode 100644
index 3323d66..0000000
--- a/src/main/java/org/opencord/cordvtn/api/dependency/DependencyService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2015-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.opencord.cordvtn.api.dependency;
-
-import org.opencord.cordvtn.api.dependency.Dependency.Type;
-import org.opencord.cordvtn.api.net.NetworkId;
-
-/**
- * Provides dependency services.
- */
-public interface DependencyService {
-
- /**
- * Creates dependencies for a given tenant service.
- *
- * @param subscriber subscriber network id
- * @param provider provider network id
- * @param type bidirectional access type
- */
- void createDependency(NetworkId subscriber, NetworkId provider, Type type);
-
- /**
- * Removes all dependencies from a given tenant service.
- *
- * @param subscriber subscriber network id
- * @param provider provider network id
- */
- void removeDependency(NetworkId subscriber, NetworkId provider);
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/dependency/package-info.java b/src/main/java/org/opencord/cordvtn/api/dependency/package-info.java
deleted file mode 100644
index 7e6589f..0000000
--- a/src/main/java/org/opencord/cordvtn/api/dependency/package-info.java
+++ /dev/null
@@ -1,20 +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.
- */
-
-/**
- * CORD VTN service dependency API definitions.
- */
-package org.opencord.cordvtn.api.dependency;
\ No newline at end of file
diff --git a/src/main/java/org/opencord/cordvtn/api/instance/package-info.java b/src/main/java/org/opencord/cordvtn/api/instance/package-info.java
deleted file mode 100644
index bdb3900..0000000
--- a/src/main/java/org/opencord/cordvtn/api/instance/package-info.java
+++ /dev/null
@@ -1,20 +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.
- */
-
-/**
- * CORD VTN service instance API definitions.
- */
-package org.opencord.cordvtn.api.instance;
\ No newline at end of file
diff --git a/src/main/java/org/opencord/cordvtn/api/node/NetworkAddress.java b/src/main/java/org/opencord/cordvtn/api/net/CidrAddr.java
similarity index 84%
rename from src/main/java/org/opencord/cordvtn/api/node/NetworkAddress.java
rename to src/main/java/org/opencord/cordvtn/api/net/CidrAddr.java
index 93bcb7a..5cd1d7e 100644
--- a/src/main/java/org/opencord/cordvtn/api/node/NetworkAddress.java
+++ b/src/main/java/org/opencord/cordvtn/api/net/CidrAddr.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.opencord.cordvtn.api.node;
+package org.opencord.cordvtn.api.net;
import com.google.common.base.MoreObjects;
import org.onlab.packet.IpAddress;
@@ -24,19 +24,19 @@
import static com.google.common.base.Preconditions.checkArgument;
/**
- * Representation of a network address, which consists of IP address and prefix.
+ * Representation of a network address with CIDR notation.
*/
-public final class NetworkAddress {
+public final class CidrAddr {
private final IpAddress ip;
private final IpPrefix prefix;
/**
* Constructor for a given IP address and prefix.
*
- * @param ip ip address
+ * @param ip ip address
* @param prefix ip prefix
*/
- public NetworkAddress(IpAddress ip, IpPrefix prefix) {
+ public CidrAddr(IpAddress ip, IpPrefix prefix) {
this.ip = ip;
this.prefix = prefix;
}
@@ -48,13 +48,13 @@
* @return network address
* @throws IllegalArgumentException if the cidr is not valid
*/
- public static NetworkAddress valueOf(String cidr) {
+ public static CidrAddr valueOf(String cidr) {
checkArgument(cidr.contains("/"));
IpAddress ipAddress = IpAddress.valueOf(cidr.split("/")[0]);
IpPrefix ipPrefix = IpPrefix.valueOf(cidr);
- return new NetworkAddress(ipAddress, ipPrefix);
+ return new CidrAddr(ipAddress, ipPrefix);
}
/**
@@ -90,8 +90,8 @@
return true;
}
- if (obj instanceof NetworkAddress) {
- NetworkAddress that = (NetworkAddress) obj;
+ if (obj instanceof CidrAddr) {
+ CidrAddr that = (CidrAddr) obj;
if (Objects.equals(ip, that.ip) && Objects.equals(prefix, that.prefix)) {
return true;
}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/NetworkService.java b/src/main/java/org/opencord/cordvtn/api/net/NetworkService.java
deleted file mode 100644
index ac505e2..0000000
--- a/src/main/java/org/opencord/cordvtn/api/net/NetworkService.java
+++ /dev/null
@@ -1,74 +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.opencord.cordvtn.api.net;
-
-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 {@link Network}, {@link Port},
- * and {@link Subnet}.
- */
-public interface NetworkService {
-
- /**
- * Returns the network with the supplied network ID.
- *
- * @param netId network id
- * @return network
- */
- Network network(NetworkId netId);
-
- /**
- * Returns all networks registered in the service.
- *
- * @return set of networks
- */
- Set<Network> networks();
-
- /**
- * Returns the port with the supplied port ID.
- *
- * @param portId port id
- * @return port
- */
- Port port(PortId portId);
-
- /**
- * Returns all ports registered in the service.
- *
- * @return set of ports
- */
- Set<Port> ports();
-
- /**
- * Returns the subnet with the supplied subnet ID.
- *
- * @param subnetId subnet id
- * @return subnet
- */
- Subnet subnet(SubnetId subnetId);
-
- /**
- * Returns all subnets registered in the service.
- *
- * @return set of subnets
- */
- Set<Subnet> subnets();
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/Provider.java b/src/main/java/org/opencord/cordvtn/api/net/Provider.java
new file mode 100644
index 0000000..e093137
--- /dev/null
+++ b/src/main/java/org/opencord/cordvtn/api/net/Provider.java
@@ -0,0 +1,138 @@
+/*
+ * 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.opencord.cordvtn.api.net;
+
+import com.google.common.base.MoreObjects;
+import org.opencord.cordvtn.api.net.ServiceNetwork.DependencyType;
+
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Representation of a provider network.
+ */
+public final class Provider {
+
+ private final ServiceNetwork provider;
+ private final DependencyType type;
+
+ private Provider(ServiceNetwork provider, DependencyType type) {
+ this.provider = provider;
+ this.type = type;
+ }
+
+ /**
+ * Returns provider network.
+ *
+ * @return service network
+ */
+ public ServiceNetwork provider() {
+ return provider;
+ }
+
+ /**
+ * Returns direct access type between subscriber and provider networks.
+ *
+ * @return type
+ */
+ public DependencyType type() {
+ return type;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj instanceof Provider) {
+ Provider that = (Provider) obj;
+ if (Objects.equals(provider, that.provider) &&
+ Objects.equals(type, that.type)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(provider, type);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("provider", provider.id())
+ .add("type", type)
+ .toString();
+ }
+
+ /**
+ * Returns new provider network builder instance.
+ *
+ * @return provider network
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Builder of the provider network entities.
+ */
+ public static final class Builder {
+ private ServiceNetwork provider;
+ private DependencyType type;
+
+ private Builder() {
+ }
+
+ /**
+ * Builds an immutable provider network.
+ *
+ * @return provider network instance
+ */
+ public Provider build() {
+ checkNotNull(provider);
+ checkNotNull(type);
+
+ return new Provider(provider, type);
+ }
+
+ /**
+ * Returns provider network with the supplied provider.
+ *
+ * @param provider provider network
+ * @return provider network builder
+ */
+ public Builder provider(ServiceNetwork provider) {
+ this.provider = provider;
+ return this;
+ }
+
+ /**
+ * Returns provider network with the supplied type.
+ *
+ * @param type type
+ * @return provider network builder
+ */
+ public Builder type(DependencyType type) {
+ this.type = type;
+ return this;
+ }
+ }
+}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/ProviderNetwork.java b/src/main/java/org/opencord/cordvtn/api/net/ProviderNetwork.java
deleted file mode 100644
index 37fce8c..0000000
--- a/src/main/java/org/opencord/cordvtn/api/net/ProviderNetwork.java
+++ /dev/null
@@ -1,97 +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.opencord.cordvtn.api.net;
-
-import com.google.common.base.MoreObjects;
-import org.opencord.cordvtn.api.dependency.Dependency.Type;
-
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Representation of a provider network.
- */
-public final class ProviderNetwork {
-
- private final NetworkId id;
- private final Type type;
-
- private ProviderNetwork(NetworkId id, Type type) {
- this.id = id;
- this.type = type;
- }
-
- /**
- * Returns network id.
- *
- * @return network id
- */
- public NetworkId id() {
- return id;
- }
-
- /**
- * Returns the direct access type with this provider network.
- *
- * @return direct access type
- */
- public Type type() {
- return type;
- }
-
- /**
- * Returns immutable provider network with the supplied network id and type.
- *
- * @param id network id
- * @param type direct access type
- * @return provider network
- */
- public static ProviderNetwork of(NetworkId id, Type type) {
- checkNotNull(id);
- checkNotNull(type);
- return new ProviderNetwork(id, type);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof ProviderNetwork) {
- ProviderNetwork that = (ProviderNetwork) obj;
- if (Objects.equals(id, that.id) &&
- Objects.equals(type, that.type)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, type);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id)
- .add("type", type)
- .toString();
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/ServiceNetwork.java b/src/main/java/org/opencord/cordvtn/api/net/ServiceNetwork.java
index 6b26daf..849a6ea 100644
--- a/src/main/java/org/opencord/cordvtn/api/net/ServiceNetwork.java
+++ b/src/main/java/org/opencord/cordvtn/api/net/ServiceNetwork.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,25 +15,19 @@
*/
package org.opencord.cordvtn.api.net;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
-import java.util.Objects;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.opencord.cordvtn.api.dependency.Dependency.Type.BIDIRECTIONAL;
+import java.util.Comparator;
+import java.util.Map;
/**
* Representation of a service network which holds service specific information,
* like service type or dependency, in addition to the common network.
*/
-public class ServiceNetwork {
+public interface ServiceNetwork {
- private static final String ERR_ID = "Service network ID cannot be null";
- private static final String ERR_TYPE = "Service network type cannot be null";
-
- public enum ServiceNetworkType {
+ enum NetworkType {
PRIVATE,
PUBLIC,
MANAGEMENT_HOST,
@@ -42,97 +36,129 @@
ACCESS_AGENT
}
- protected final NetworkId id;
- protected final ServiceNetworkType type;
- protected final Set<ProviderNetwork> providers;
-
- public ServiceNetwork(NetworkId id,
- ServiceNetworkType type,
- Set<ProviderNetwork> providers) {
- this.id = checkNotNull(id, ERR_ID);
- this.type = checkNotNull(type, ERR_TYPE);
- this.providers = providers == null ? ImmutableSet.of() : providers;
+ enum DependencyType {
+ BIDIRECTIONAL,
+ UNIDIRECTIONAL
}
+ Comparator<ServiceNetwork> SERVICE_NETWORK_COMPARATOR =
+ (net1, net2) -> net1.id().id().compareTo(net2.id().id());
+
/**
- * Returns the network id of the service network.
+ * Returns the service network identifier.
*
- * @return network id
+ * @return service network identifier
*/
- public NetworkId id() {
- return id;
- }
+ NetworkId id();
+
+ /**
+ * Returns the service network name.
+ *
+ * @return service network name.
+ */
+ String name();
/**
* Returns the type of the service network.
*
- * @return service network type
+ * @return service network type; empty value if type is not set
*/
- public ServiceNetworkType type() {
- return type;
- }
+ NetworkType type();
/**
- * Returns the provider networks of this service network if exists.
+ * Returns the service network segmentation identifier.
*
- * @return provider networks
+ * @return segmentation id; empty value if segment id is not set
*/
- public Set<ProviderNetwork> providers() {
- return providers;
- }
+ SegmentId segmentId();
/**
- * Returns if the given network is the provider of this network or not.
+ * Returns the subnet of the service network.
*
- * @param netId network id
- * @return true if the given network is the provider of this network
+ * @return subnet ip prefix; empty value if subnet is not set
*/
- public boolean isProvider(NetworkId netId) {
- return providers.stream().filter(p -> Objects.equals(p.id(), netId))
- .findAny().isPresent();
- }
+ IpPrefix subnet();
/**
- * Returns if the given network is the provider of this network with
- * bidirectional access type.
+ * Returns the service IP address of the service network.
*
- * @param netId network id
- * @return true if the given network is a bidrectional provider
+ * @return service ip; empty value if service ip is not set
*/
- public boolean isBidirectionalProvider(NetworkId netId) {
- return providers.stream().filter(p -> Objects.equals(p.id(), netId))
- .filter(p -> p.type() == BIDIRECTIONAL)
- .findAny().isPresent();
- }
+ IpAddress serviceIp();
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
+ /**
+ * Returns the providers of the service network.
+ *
+ * @return set of provider networks; empty map if no providers exist
+ */
+ Map<NetworkId, DependencyType> providers();
- if (obj instanceof ServiceNetwork) {
- ServiceNetwork that = (ServiceNetwork) obj;
- if (Objects.equals(id, that.id) &&
- Objects.equals(type, that.type) &&
- Objects.equals(providers, that.providers)) {
- return true;
- }
- }
- return false;
- }
+ /**
+ * Builder of new service network entities.
+ */
+ interface Builder {
- @Override
- public int hashCode() {
- return Objects.hash(id, type, providers);
- }
+ /**
+ * Builds an immutable service network instance.
+ *
+ * @return service network instance
+ */
+ ServiceNetwork build();
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("networkId", id)
- .add("type", type)
- .add("providers", providers)
- .toString();
+ /**
+ * Returns service network builder with the supplied identifier.
+ *
+ * @param networkId network id
+ * @return service network builder
+ */
+ Builder id(NetworkId networkId);
+
+ /**
+ * Returns service network builder with the supplied name.
+ *
+ * @param name network name
+ * @return service network builder
+ */
+ Builder name(String name);
+
+ /**
+ * Returns service network builder with the supplied type.
+ *
+ * @param type service network type
+ * @return service network builder
+ */
+ Builder type(NetworkType type);
+
+ /**
+ * Returns service network builder with the supplied segmentation id.
+ *
+ * @param segmentId segmentation id
+ * @return service network builder
+ */
+ Builder segmentId(SegmentId segmentId);
+
+ /**
+ * Returns service network builder with the supplied subnet.
+ *
+ * @param subnet subnet
+ * @return service network builder
+ */
+ Builder subnet(IpPrefix subnet);
+
+ /**
+ * Returns service network builder with the supplied service IP address.
+ *
+ * @param serviceIp service ip address
+ * @return service network builder
+ */
+ Builder serviceIp(IpAddress serviceIp);
+
+ /**
+ * Returns service network builder with the supplied providers.
+ *
+ * @param providers set of provider network
+ * @return service network builder
+ */
+ Builder providers(Map<NetworkId, DependencyType> providers);
}
}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/ServicePort.java b/src/main/java/org/opencord/cordvtn/api/net/ServicePort.java
index 99a79ff..83117ee 100644
--- a/src/main/java/org/opencord/cordvtn/api/net/ServicePort.java
+++ b/src/main/java/org/opencord/cordvtn/api/net/ServicePort.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,91 +15,137 @@
*/
package org.opencord.cordvtn.api.net;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.Comparator;
import java.util.Set;
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* Representation of a service port which holds service specific port information,
* like vlan tag or additional addresses, to the common network port.
*/
-public class ServicePort {
+public interface ServicePort {
- private static final String ERR_ID = "Service port ID cannot be null";
-
- protected final PortId id;
- protected final VlanId vlanId;
- protected final Set<AddressPair> addressPairs;
-
- public ServicePort(PortId id,
- VlanId vlanId,
- Set<AddressPair> addressPairs) {
- this.id = checkNotNull(id, ERR_ID);
- this.vlanId = vlanId;
- this.addressPairs = addressPairs == null ? ImmutableSet.of() : addressPairs;
- }
+ Comparator<ServicePort> SERVICE_PORT_COMPARATOR =
+ (port1, port2) -> port1.networkId().id().compareTo(port2.networkId().id());
/**
- * Returns the port id of the service port.
+ * Returns the port identifier.
*
* @return port id
*/
- public PortId id() {
- return id;
- }
+ PortId id();
/**
- * Returns the vlan id of the the service port if exists.
+ * Returns the port name.
+ *
+ * @return port name
+ */
+ String name();
+
+ /**
+ * Returns associated network identifier of the service port.
+ *
+ * @return network id
+ */
+ NetworkId networkId();
+
+ /**
+ * Returns the MAC address of the service port.
+ *
+ * @return mac address
+ */
+ MacAddress mac();
+
+ /**
+ * Returns the fixed IP address of the service port.
+ *
+ * @return ip address
+ */
+ IpAddress ip();
+
+ /**
+ * Returns VLAN of service the port.
*
* @return vlan id
*/
- public Optional<VlanId> vlanId() {
- return Optional.ofNullable(vlanId);
- }
+ VlanId vlanId();
/**
- * Returns the additional address pairs used in this port.
+ * Returns additional floating address pairs of the service port.
*
- * @return set of ip and mac address pairs
+ * @return set of mac and ip address pair
*/
- public Set<AddressPair> addressPairs() {
- return addressPairs;
- }
+ Set<AddressPair> addressPairs();
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
+ /**
+ * Builder of new service port entities.
+ */
+ interface Builder {
- if (obj instanceof ServicePort) {
- ServicePort that = (ServicePort) obj;
- if (Objects.equals(id, that.id) &&
- Objects.equals(vlanId, that.vlanId) &&
- Objects.equals(addressPairs, that.addressPairs)) {
- return true;
- }
- }
- return false;
- }
+ /**
+ * Builds an immutable service port instance.
+ *
+ * @return service port
+ */
+ ServicePort build();
- @Override
- public int hashCode() {
- return Objects.hash(id, vlanId, addressPairs);
- }
+ /**
+ * Returns service port builder with the supplied identifier.
+ *
+ * @param id port id
+ * @return service port builder
+ */
+ Builder id(PortId id);
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("portId", id)
- .add("vlanId", vlanId)
- .add("addressPairs", addressPairs)
- .toString();
+ /**
+ * Returns service port builder with the supplied name.
+ *
+ * @param name port name
+ * @return service port builder
+ */
+ Builder name(String name);
+
+ /**
+ * Returns service port builder with the supplied network identifier.
+ *
+ * @param networkId network id
+ * @return service port builder
+ */
+ Builder networkId(NetworkId networkId);
+
+ /**
+ * Returns service port builder with the supplied MAC address.
+ *
+ * @param mac mac address
+ * @return service port builder
+ */
+ Builder mac(MacAddress mac);
+
+ /**
+ * Returns service port builder with the supplied IP address.
+ *
+ * @param ip ip address
+ * @return service port builder
+ */
+ Builder ip(IpAddress ip);
+
+ /**
+ * Returns service port builder with the supplied VLAN.
+ *
+ * @param vlanId vlan id
+ * @return service port builder
+ */
+ Builder vlanId(VlanId vlanId);
+
+ /**
+ * Returns service port builder with the supplied address pairs.
+ *
+ * @param addressPairs set of address pair
+ * @return service port builder
+ */
+ Builder addressPairs(Set<AddressPair> addressPairs);
}
}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/SubnetId.java b/src/main/java/org/opencord/cordvtn/api/net/SubnetId.java
deleted file mode 100644
index b7c49bd..0000000
--- a/src/main/java/org/opencord/cordvtn/api/net/SubnetId.java
+++ /dev/null
@@ -1,43 +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.opencord.cordvtn.api.net;
-
-import org.onlab.util.Identifier;
-
-/**
- * Representation of the subnet identifier.
- */
-public final class SubnetId extends Identifier<String> {
-
- /**
- * Default constructor.
- *
- * @param id string subnet identifier
- */
- private SubnetId(String id) {
- super(id);
- }
-
- /**
- * Returns the subnet identifier with the supplied value.
- *
- * @param id string subnet identifier
- * @return subnet identifier
- */
- public static SubnetId of(String id) {
- return new SubnetId(id);
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/VtnNetwork.java b/src/main/java/org/opencord/cordvtn/api/net/VtnNetwork.java
deleted file mode 100644
index c4ae68e..0000000
--- a/src/main/java/org/opencord/cordvtn/api/net/VtnNetwork.java
+++ /dev/null
@@ -1,330 +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.opencord.cordvtn.api.net;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.opencord.cordvtn.api.dependency.Dependency;
-import org.openstack4j.model.network.Network;
-import org.openstack4j.model.network.Subnet;
-
-import java.util.Comparator;
-import java.util.Objects;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.opencord.cordvtn.api.net.ServiceNetwork.ServiceNetworkType.PRIVATE;
-
-/**
- * Representation of a network holding the basic virtual network and additional
- * service network specific information.
- * All the services making use of CordVtnService are intended to interface
- * with this VtnNetwork, and not allowed to directly access {@link Network} or
- * {@link ServiceNetwork}.
- */
-public final class VtnNetwork extends ServiceNetwork {
-
- private static final String ERR_SEGMENT_ID_MISSING = "VTN network segment ID is missing";
- private static final String ERR_GATEWAY_IP_MISSING = "VTN subnet gateway IP is missing";
-
- private final SegmentId segmentId;
- private final IpPrefix subnet;
- private final IpAddress serviceIp;
-
- private VtnNetwork(NetworkId id,
- SegmentId segmentId,
- IpPrefix subnet,
- IpAddress serviceIp,
- ServiceNetworkType type,
- Set<ProviderNetwork> providers) {
- super(id, type, providers);
- this.segmentId = segmentId;
- this.subnet = subnet;
- this.serviceIp = serviceIp;
- }
-
- public static final Comparator<VtnNetwork> VTN_NETWORK_COMPARATOR =
- (net1, net2) -> net1.serviceIp().compareTo(net2.serviceIp());
-
- /**
- * Returns the network ID.
- *
- * @return network id
- */
- public NetworkId id() {
- return id;
- }
-
- /**
- * Returns the segment ID of this network.
- *
- * @return segment id
- */
- public SegmentId segmentId() {
- return segmentId;
- }
-
- /**
- * Returns the subnet used in this network.
- *
- * @return subnet
- */
- public IpPrefix subnet() {
- return subnet;
- }
-
- /**
- * Returns the service IP address of this network.
- *
- * @return ip address
- */
- public IpAddress serviceIp() {
- return serviceIp;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof VtnNetwork) {
- VtnNetwork that = (VtnNetwork) obj;
- if (Objects.equals(id, that.id) &&
- Objects.equals(segmentId, that.segmentId) &&
- Objects.equals(subnet, that.subnet) &&
- Objects.equals(serviceIp, that.serviceIp) &&
- Objects.equals(type, that.type) &&
- Objects.equals(providers, that.providers)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, segmentId, subnet, serviceIp, type, providers);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id)
- .add("segmentId", segmentId)
- .add("subnet", subnet)
- .add("serviceIp", serviceIp)
- .add("type", type)
- .add("providers", providers)
- .toString();
- }
-
- /**
- * Returns immutable VTN network with the supplied Neutron network, subnet,
- * and additional service network information.
- *
- * @param network neutron network
- * @param subnet neutron subnet
- * @param serviceNet service network
- * @return vtn network
- */
- public static VtnNetwork of(Network network, Subnet subnet, ServiceNetwork serviceNet) {
- validateNeutronNetwork(network, subnet);
- if (serviceNet != null) {
- checkArgument(Objects.equals(network.getId(), serviceNet.id().id()));
- }
-
- return builder().id(NetworkId.of(network.getId()))
- .segmentId(SegmentId.of(Long.valueOf(network.getProviderSegID())))
- .subnet(IpPrefix.valueOf(subnet.getCidr()))
- .serviceIp(IpAddress.valueOf(subnet.getGateway()))
- .type(serviceNet == null ? PRIVATE : serviceNet.type())
- .providers(serviceNet == null ? ImmutableSet.of() : serviceNet.providers())
- .build();
- }
-
- private static void validateNeutronNetwork(Network network, Subnet subnet) {
- checkNotNull(network);
- checkNotNull(subnet);
- checkArgument(Objects.equals(network.getId(), subnet.getNetworkId()));
- checkArgument(!Strings.isNullOrEmpty(network.getProviderSegID()), ERR_SEGMENT_ID_MISSING);
- checkArgument(!Strings.isNullOrEmpty(subnet.getGateway()), ERR_GATEWAY_IP_MISSING);
- }
-
- /**
- * Returns new vtn network builder instance.
- *
- * @return vtn network builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Returns new vtn network builder instance with copy of the given vtn network.
- *
- * @param vtnNet vtn network
- * @return vtn network builder
- */
- public static Builder builder(VtnNetwork vtnNet) {
- return new Builder()
- .id(vtnNet.id())
- .segmentId(vtnNet.segmentId())
- .subnet(vtnNet.subnet())
- .serviceIp(vtnNet.serviceIp())
- .type(vtnNet.type())
- .providers(vtnNet.providers());
- }
-
- /**
- * Builder of the vtn network entities.
- */
- public static final class Builder {
- private NetworkId id;
- private SegmentId segmentId;
- private IpPrefix subnet;
- private IpAddress serviceIp;
- private ServiceNetworkType type;
- private Set<ProviderNetwork> providers = ImmutableSet.of();
-
- private Builder() {
- }
-
- /**
- * Builds an immutable vtn network.
- *
- * @return vtn network instance
- */
- public VtnNetwork build() {
- checkNotNull(id, "VTN network id cannot be null");
- checkNotNull(segmentId, "VTN network segment id cannot be null");
- checkNotNull(subnet, "VTN network subnet cannot be null");
- checkNotNull(serviceIp, "VTN network service IP cannot be null");
- checkNotNull(type, "VTN network type cannot be null");
- providers = providers == null ? ImmutableSet.of() : providers;
-
- return new VtnNetwork(id, segmentId, subnet, serviceIp, type, providers);
- }
-
- /**
- * Returns vtn network builder with the supplied network ID.
- *
- * @param id network id
- * @return vtn network builder
- */
- public Builder id(NetworkId id) {
- this.id = id;
- return this;
- }
-
- /**
- * Returns vtn network builder with the supplied segment ID.
- *
- * @param segmentId segment id
- * @return vtn network builder
- */
- public Builder segmentId(SegmentId segmentId) {
- this.segmentId = segmentId;
- return this;
- }
-
- /**
- * Returns vtn network builder with the supplied subnet.
- *
- * @param subnet subnet
- * @return vtn network builder
- */
- public Builder subnet(IpPrefix subnet) {
- this.subnet = subnet;
- return this;
- }
-
- /**
- * Returns vtn network service IP address.
- *
- * @param serviceIp service ip address
- * @return vtn network builder
- */
- public Builder serviceIp(IpAddress serviceIp) {
- this.serviceIp = serviceIp;
- return this;
- }
-
- /**
- * Returns vtn network builder with the supplied service network type.
- *
- * @param type service network type
- * @return vtn network builder
- */
- public Builder type(ServiceNetworkType type) {
- this.type = type;
- return this;
- }
-
- /**
- * Returns vtn network builder with the supplied provider service networks.
- *
- * @param providers provider service networks
- * @return vtn network builder
- */
- public Builder providers(Set<ProviderNetwork> providers) {
- this.providers = providers;
- return this;
- }
-
- /**
- * Returns vtn network builder with the given additional provider network.
- *
- * @param providerId provider network id
- * @param type direct access type to the provider network
- * @return vtn network builder
- */
- public Builder addProvider(NetworkId providerId, Dependency.Type type) {
- checkNotNull(providerId, "Provider network ID cannot be null");
- checkNotNull(type, "Provider network type cannot be null");
-
- Set<ProviderNetwork> updated = Sets.newHashSet(this.providers);
- updated.add(ProviderNetwork.of(providerId, type));
- this.providers = ImmutableSet.copyOf(updated);
- return this;
- }
-
- /**
- * Returns vtn network builder without the given provider network.
- *
- * @param providerId provider network id
- * @return vtn network builder
- */
- public Builder delProvider(NetworkId providerId) {
- checkNotNull(providerId, "Provider network ID cannot be null");
-
- ProviderNetwork provider = this.providers.stream()
- .filter(p -> Objects.equals(p.id(), providerId))
- .findAny().orElse(null);
- if (provider != null) {
- Set<ProviderNetwork> updated = Sets.newHashSet(this.providers);
- updated.remove(provider);
- this.providers = ImmutableSet.copyOf(updated);
- }
- return this;
- }
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/VtnNetworkEvent.java b/src/main/java/org/opencord/cordvtn/api/net/VtnNetworkEvent.java
deleted file mode 100644
index c6f187f..0000000
--- a/src/main/java/org/opencord/cordvtn/api/net/VtnNetworkEvent.java
+++ /dev/null
@@ -1,112 +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.opencord.cordvtn.api.net;
-
-import org.joda.time.LocalDateTime;
-import org.onosproject.event.AbstractEvent;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Describes vtn network event.
- */
-public class VtnNetworkEvent extends AbstractEvent<VtnNetworkEvent.Type, VtnNetwork> {
-
- private final VtnPort vtnPort;
-
- /**
- * Type of vtn network event.
- */
- public enum Type {
- /**
- * Signifies that a new vtn network has been created.
- */
- VTN_NETWORK_CREATED,
-
- /**
- * Signifies that some vtn network attributes have changed.
- */
- VTN_NETWORK_UPDATED,
-
- /**
- * Signifies that a vtn network has been removed.
- */
- VTN_NETWORK_REMOVED,
-
- /**
- * Signifies that a new vtn port has been created.
- */
- VTN_PORT_CREATED,
-
- /**
- * Signifies that some vtn port attributes have changed.
- */
- VTN_PORT_UPDATED,
-
- /**
- * Signifies that a vtn port has been removed.
- */
- VTN_PORT_REMOVED
- }
-
- /**
- * Creates an event of a given type and for the specified vtn network and
- * the current time.
- *
- * @param type vtn network event type
- * @param vtnNet vtn network subject
- */
- public VtnNetworkEvent(Type type, VtnNetwork vtnNet) {
- super(type, vtnNet);
- this.vtnPort = null;
- }
-
- /**
- * Creates an event of a given type and for the specified vtn network,
- * port and the current time.
- *
- * @param type vtn network event type
- * @param vtnNet vtn network subject
- * @param vtnPort optional vtn port subject
- */
- public VtnNetworkEvent(Type type, VtnNetwork vtnNet, VtnPort vtnPort) {
- super(type, vtnNet);
- this.vtnPort = vtnPort;
- }
-
- /**
- * Returns the vtn port subject.
- * It returns valid value only with the vtn port events.
- *
- * @return vtn port or null if the event is not vtn port specific
- */
- public VtnPort vtnPort() {
- return vtnPort;
- }
-
- @Override
- public String toString() {
- if (vtnPort == null) {
- return super.toString();
- }
- return toStringHelper(this)
- .add("time", new LocalDateTime(time()))
- .add("type", type())
- .add("vtnNet", subject())
- .add("vtnPort", vtnPort)
- .toString();
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/net/VtnPort.java b/src/main/java/org/opencord/cordvtn/api/net/VtnPort.java
deleted file mode 100644
index 1f07218..0000000
--- a/src/main/java/org/opencord/cordvtn/api/net/VtnPort.java
+++ /dev/null
@@ -1,304 +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.opencord.cordvtn.api.net;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.openstack4j.model.network.Port;
-
-import java.util.Comparator;
-import java.util.Objects;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Representation of a port holding the basic virtual port and additional service
- * port specific information.
- * All the services making use of CordVtnService are intended to interface
- * with this VtnPort, and not allowed to directly access {@link Port} or
- * {@link ServicePort}.
- */
-public final class VtnPort extends ServicePort {
-
- private static final String ERR_IP_MISSING = "VTN port IP address is missing";
-
- private final NetworkId netId;
- private final MacAddress mac;
- private final IpAddress ip;
-
- private VtnPort(PortId id,
- NetworkId netId,
- MacAddress mac,
- IpAddress ip,
- VlanId vlanId,
- Set<AddressPair> addressPairs) {
- super(id, vlanId, addressPairs);
- this.netId = netId;
- this.mac = mac;
- this.ip = ip;
- }
-
- public static final Comparator<VtnPort> VTN_PORT_COMPARATOR =
- (port1, port2) -> port1.ip().compareTo(port2.ip());
-
- /**
- * Returns the network ID of this port.
- *
- * @return network id
- */
- public NetworkId netId() {
- return netId;
- }
-
- /**
- * Returns the MAC address of this port.
- *
- * @return mac address
- */
- public MacAddress mac() {
- return mac;
- }
-
- /**
- * Returns the IP address of this port.
- *
- * @return ip address
- */
- public IpAddress ip() {
- return ip;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (obj instanceof VtnPort) {
- VtnPort that = (VtnPort) obj;
- if (Objects.equals(id, that.id) &&
- Objects.equals(netId, that.netId) &&
- Objects.equals(mac, that.mac) &&
- Objects.equals(ip, that.ip) &&
- Objects.equals(vlanId, that.vlanId) &&
- Objects.equals(addressPairs, that.addressPairs)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, netId, mac, ip, vlanId, addressPairs);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id)
- .add("netId", netId)
- .add("mac", mac)
- .add("ip", ip)
- .add("vlanId", vlanId)
- .add("addressPairs", addressPairs)
- .toString();
- }
-
- /**
- * Returns the immutable VTN port with the supplied Neutron port with additional
- * vtn port information.
- *
- * @param port neutron port
- * @param servicePort vtn port
- * @return vtn port
- */
- public static VtnPort of(Port port, ServicePort servicePort) {
- validateNeutronPort(port);
- if (servicePort != null) {
- checkArgument(Objects.equals(port.getId(), servicePort.id().id()));
- }
-
- return builder().id(PortId.of(port.getId()))
- .netId(NetworkId.of(port.getNetworkId()))
- .mac(MacAddress.valueOf(port.getMacAddress()))
- .ip(IpAddress.valueOf(port.getFixedIps().iterator().next().getIpAddress()))
- .vlanId(servicePort == null ? null : servicePort.vlanId().orElse(null))
- .addressPairs(servicePort == null ? ImmutableSet.of() : servicePort.addressPairs())
- .build();
- }
-
- private static void validateNeutronPort(Port port) {
- checkNotNull(port);
- checkArgument(port.getFixedIps().size() > 0, ERR_IP_MISSING);
- }
-
- /**
- * Returns the immutable VTN port with the supplied VTN port with additional
- * vtn port information.
- *
- * @param vtnPort vtn port
- * @param servicePort vtn port
- * @return vtn port
- */
- public static VtnPort of(VtnPort vtnPort, ServicePort servicePort) {
- return builder(vtnPort)
- .vlanId(servicePort.vlanId().orElse(null))
- .addressPairs(servicePort.addressPairs())
- .build();
- }
-
- /**
- * Returns new vtn port builder instance.
- *
- * @return vtn port builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Returns new vtn port builder instance with copy of the supplied vtn port.
- *
- * @param vtnPort vtn port
- * @return vtn port builder
- */
- public static Builder builder(VtnPort vtnPort) {
- return new Builder().id(vtnPort.id())
- .netId(vtnPort.netId())
- .mac(vtnPort.mac())
- .ip(vtnPort.ip())
- .vlanId(vtnPort.vlanId().orElse(null))
- .addressPairs(vtnPort.addressPairs());
- }
-
- /**
- * Builder of the vtn port entities.
- */
- public static final class Builder {
- private PortId id;
- private NetworkId netId;
- private MacAddress mac;
- private IpAddress ip;
- private VlanId vlanId;
- private Set<AddressPair> addressPairs = ImmutableSet.of();
-
- private Builder() {
- }
-
- /**
- * Builds an immutable vtn port.
- *
- * @return vtn port instance
- */
- public VtnPort build() {
- checkNotNull(id, "VtnPort port id cannot be null");
- checkNotNull(netId, "VtnPort network id cannot be null");
- checkNotNull(mac, "VtnPort mac address cannot be null");
- checkNotNull(ip, "VtnPort ip address cannot be null");
- addressPairs = addressPairs == null ? ImmutableSet.of() : addressPairs;
-
- return new VtnPort(id, netId, mac, ip, vlanId, addressPairs);
- }
-
- /**
- * Returns vtn port builder with the supplied port id.
- *
- * @param id port id
- * @return vtn port builder
- */
- public Builder id(PortId id) {
- this.id = id;
- return this;
- }
-
- /**
- * Returns vtn port builder with the supplied network id.
- *
- * @param netId network id
- * @return vtn port builder
- */
- public Builder netId(NetworkId netId) {
- this.netId = netId;
- return this;
- }
-
- /**
- * Returns vtn port builder with the supplied mac address.
- *
- * @param mac mac address
- * @return vtn port builder
- */
- public Builder mac(MacAddress mac) {
- this.mac = mac;
- return this;
- }
-
- /**
- * Returns vtn port builder with the supplied ip address.
- *
- * @param ip ip address
- * @return vtn port builder
- */
- public Builder ip(IpAddress ip) {
- this.ip = ip;
- return this;
- }
-
- /**
- * Returns vtn port builder with the supplied VLAN ID.
- *
- * @param vlanId vlan id
- * @return vtn port builder
- */
- public Builder vlanId(VlanId vlanId) {
- this.vlanId = vlanId;
- return this;
- }
-
- /**
- * Returns vtn port builder with the supplied address pairs.
- *
- * @param addressPairs set of address pairs
- * @return vtn port builder
- */
- public Builder addressPairs(Set<AddressPair> addressPairs) {
- this.addressPairs = addressPairs;
- return this;
- }
-
- /**
- * Returns vtn port builder with the given additional address pair.
- *
- * @param addressPair address pair to add
- * @return vtn port builder
- */
- public Builder addAddressPair(AddressPair addressPair) {
- checkNotNull(addressPair, "VtnPort address pair cannot be null");
-
- Set<AddressPair> updated = Sets.newHashSet(this.addressPairs);
- updated.add(addressPair);
- this.addressPairs = ImmutableSet.copyOf(updated);
- return this;
- }
- }
-}
diff --git a/src/main/java/org/opencord/cordvtn/api/node/CordVtnNode.java b/src/main/java/org/opencord/cordvtn/api/node/CordVtnNode.java
index d4339df..153eed3 100644
--- a/src/main/java/org/opencord/cordvtn/api/node/CordVtnNode.java
+++ b/src/main/java/org/opencord/cordvtn/api/node/CordVtnNode.java
@@ -20,6 +20,7 @@
import com.google.common.collect.Sets;
import org.onlab.packet.TpPort;
import org.onosproject.net.DeviceId;
+import org.opencord.cordvtn.api.net.CidrAddr;
import java.util.Comparator;
import java.util.Objects;
@@ -37,9 +38,9 @@
public final class CordVtnNode {
private final String hostname;
- private final NetworkAddress hostMgmtIp;
- private final NetworkAddress localMgmtIp;
- private final NetworkAddress dataIp;
+ private final CidrAddr hostMgmtIp;
+ private final CidrAddr localMgmtIp;
+ private final CidrAddr dataIp;
private final Optional<TpPort> ovsdbPort;
private final SshAccessInfo sshInfo;
private final DeviceId integrationBridgeId;
@@ -65,9 +66,9 @@
* @param state cordvtn node state
*/
private CordVtnNode(String hostname,
- NetworkAddress hostMgmtIp,
- NetworkAddress localMgmtIp,
- NetworkAddress dataIp,
+ CidrAddr hostMgmtIp,
+ CidrAddr localMgmtIp,
+ CidrAddr dataIp,
Optional<TpPort> ovsdbPort,
SshAccessInfo sshInfo,
DeviceId integrationBridgeId,
@@ -117,7 +118,7 @@
*
* @return network address
*/
- public NetworkAddress hostMgmtIp() {
+ public CidrAddr hostMgmtIp() {
return this.hostMgmtIp;
}
@@ -126,7 +127,7 @@
*
* @return network address
*/
- public NetworkAddress localMgmtIp() {
+ public CidrAddr localMgmtIp() {
return this.localMgmtIp;
}
@@ -135,7 +136,7 @@
*
* @return network address
*/
- public NetworkAddress dataIp() {
+ public CidrAddr dataIp() {
return this.dataIp;
}
@@ -286,9 +287,9 @@
*/
public static final class Builder {
private String hostname;
- private NetworkAddress hostMgmtIp;
- private NetworkAddress localMgmtIp;
- private NetworkAddress dataIp;
+ private CidrAddr hostMgmtIp;
+ private CidrAddr localMgmtIp;
+ private CidrAddr dataIp;
private Optional<TpPort> ovsdbPort =
Optional.of(TpPort.tpPort(DEFAULT_OVSDB_PORT));
private SshAccessInfo sshInfo;
@@ -344,7 +345,7 @@
* @param hostMgmtIp host management netework ip address
* @return cordvtn node builder
*/
- public Builder hostMgmtIp(NetworkAddress hostMgmtIp) {
+ public Builder hostMgmtIp(CidrAddr hostMgmtIp) {
checkNotNull(hostMgmtIp);
this.hostMgmtIp = hostMgmtIp;
return this;
@@ -357,7 +358,7 @@
* @return cordvtn node builder
*/
public Builder hostMgmtIp(String cidr) {
- this.hostMgmtIp = NetworkAddress.valueOf(cidr);
+ this.hostMgmtIp = CidrAddr.valueOf(cidr);
return this;
}
@@ -367,7 +368,7 @@
* @param localMgmtIp local management network ip address
* @return cordvtn node builder
*/
- public Builder localMgmtIp(NetworkAddress localMgmtIp) {
+ public Builder localMgmtIp(CidrAddr localMgmtIp) {
checkNotNull(localMgmtIp);
this.localMgmtIp = localMgmtIp;
return this;
@@ -380,7 +381,7 @@
* @return cordvtn node builder
*/
public Builder localMgmtIp(String cidr) {
- this.localMgmtIp = NetworkAddress.valueOf(cidr);
+ this.localMgmtIp = CidrAddr.valueOf(cidr);
return this;
}
@@ -390,7 +391,7 @@
* @param dataIp data network ip address
* @return cordvtn node builder
*/
- public Builder dataIp(NetworkAddress dataIp) {
+ public Builder dataIp(CidrAddr dataIp) {
checkNotNull(dataIp);
this.dataIp = dataIp;
return this;
@@ -403,7 +404,7 @@
* @return cordvtn node builder
*/
public Builder dataIp(String cidr) {
- this.dataIp = NetworkAddress.valueOf(cidr);
+ this.dataIp = CidrAddr.valueOf(cidr);
return this;
}