CNlucius
Committed by Gerrit Code Review

ONOS-2622

Fix error of north app and update onos-app-vtnrsc package

Change-Id: I375002ff26d2ab3ada879a92a1d47bcdb8980054
Showing 41 changed files with 2233 additions and 2164 deletions
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
<repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
<feature name="onos-app-vtnrsc" version="@FEATURE-VERSION"
description="ONOS app vtnrsc components">
<feature>onos-api</feature>
<bundle>mvn:org.onosproject/onos-app-vtnrsc/@ONOS-VERSION
</bundle>
</feature>
</features>
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import org.onlab.packet.IpAddress;
/**
* The continuous IP address range between the start address and the end address for the allocation pools.
*/
public interface AllocationPool {
/**
* The start address for the allocation pool.
*
* @return startIp
*/
IpAddress startIp();
/**
* The end address for the allocation pool.
*
* @return endIp
*/
IpAddress endIp();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import org.onlab.packet.IpAddress;
/**
* The continuous IP address range between the start address and the end address for the allocation pools.
*/
public interface AllocationPool {
/**
* The start address for the allocation pool.
*
* @return startIp
*/
IpAddress startIp();
/**
* The end address for the allocation pool.
*
* @return endIp
*/
IpAddress endIp();
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
/**
* Immutable representation of a allowed address pair.
*/
public final class AllowedAddressPair {
private final IpAddress ip;
private final MacAddress mac;
// Public construction is prohibited
private AllowedAddressPair(IpAddress ip, MacAddress mac) {
checkNotNull(ip, "IpAddress cannot be null");
checkNotNull(mac, "MacAddress cannot be null");
this.ip = ip;
this.mac = mac;
}
/**
* Returns the AllowedAddressPair ip address.
*
* @return ip address
*/
public IpAddress ip() {
return ip;
}
/**
* Returns the AllowedAddressPair MAC address.
*
* @return MAC address
*/
public MacAddress mac() {
return mac;
}
/**
* Creates a allowedAddressPair using the supplied ipAddress &amp;
* macAddress.
*
* @param ip IP address
* @param mac MAC address
* @return AllowedAddressPair
*/
public static AllowedAddressPair allowedAddressPair(IpAddress ip,
MacAddress mac) {
return new AllowedAddressPair(ip, mac);
}
@Override
public int hashCode() {
return Objects.hash(ip, mac);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AllowedAddressPair) {
final AllowedAddressPair that = (AllowedAddressPair) obj;
return Objects.equals(this.ip, that.ip)
&& Objects.equals(this.mac, that.mac);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("ip", ip).add("mac", mac).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
/**
* Immutable representation of a allowed address pair.
*/
public final class AllowedAddressPair {
private final IpAddress ip;
private final MacAddress mac;
// Public construction is prohibited
private AllowedAddressPair(IpAddress ip, MacAddress mac) {
checkNotNull(ip, "IpAddress cannot be null");
checkNotNull(mac, "MacAddress cannot be null");
this.ip = ip;
this.mac = mac;
}
/**
* Returns the AllowedAddressPair ip address.
*
* @return ip address
*/
public IpAddress ip() {
return ip;
}
/**
* Returns the AllowedAddressPair MAC address.
*
* @return MAC address
*/
public MacAddress mac() {
return mac;
}
/**
* Creates a allowedAddressPair using the supplied ipAddress &amp;
* macAddress.
*
* @param ip IP address
* @param mac MAC address
* @return AllowedAddressPair
*/
public static AllowedAddressPair allowedAddressPair(IpAddress ip,
MacAddress mac) {
return new AllowedAddressPair(ip, mac);
}
@Override
public int hashCode() {
return Objects.hash(ip, mac);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AllowedAddressPair) {
final AllowedAddressPair that = (AllowedAddressPair) obj;
return Objects.equals(this.ip, that.ip)
&& Objects.equals(this.mac, that.mac);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("ip", ip).add("mac", mac).toString();
}
}
......
package org.onosproject.vtnrsc;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
public final class BindingHostId {
private final String bindingHostId;
// Public construction is prohibited
private BindingHostId(String bindingHostId) {
checkNotNull(bindingHostId, "BindingHosttId cannot be null");
this.bindingHostId = bindingHostId;
}
/**
* Creates a BindingHostId identifier.
*
* @param bindingHostId the bindingHostId identifier
* @return the bindingHostId identifier
*/
public static BindingHostId bindingHostId(String bindingHostId) {
return new BindingHostId(bindingHostId);
}
/**
* Returns the bindingHostId identifier.
*
* @return the bindingHostId identifier
*/
public String bindingHostId() {
return bindingHostId;
}
@Override
public int hashCode() {
return Objects.hash(bindingHostId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof BindingHostId) {
final BindingHostId that = (BindingHostId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.bindingHostId, that.bindingHostId);
}
return false;
}
@Override
public String toString() {
return bindingHostId;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.packet.IpAddress;
/**
* The continuous IP address range between the start address and the end address
* for the allocation pools.
*/
public final class DefaultAllocationPool implements AllocationPool {
private final IpAddress startIp;
private final IpAddress endIp;
/**
* Creates an AllocationPool by using the start IP address and the end IP
* address.
*
* @param startIp the start IP address of the allocation pool
* @param endIp the end IP address of the allocation pool
*/
public DefaultAllocationPool(IpAddress startIp, IpAddress endIp) {
checkNotNull(startIp, "StartIp cannot be null");
checkNotNull(endIp, "EndIp cannot be null");
this.startIp = startIp;
this.endIp = endIp;
}
@Override
public IpAddress startIp() {
return startIp;
}
@Override
public IpAddress endIp() {
return endIp;
}
@Override
public int hashCode() {
return Objects.hash(startIp, endIp);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultAllocationPool) {
final DefaultAllocationPool other = (DefaultAllocationPool) obj;
return Objects.equals(this.startIp, other.startIp)
&& Objects.equals(this.endIp, other.endIp);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("startIp", startIp).add("endIp", endIp)
.toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.packet.IpAddress;
/**
* The continuous IP address range between the start address and the end address
* for the allocation pools.
*/
public final class DefaultAllocationPool implements AllocationPool {
private final IpAddress startIp;
private final IpAddress endIp;
/**
* Creates an AllocationPool by using the start IP address and the end IP
* address.
*
* @param startIp the start IP address of the allocation pool
* @param endIp the end IP address of the allocation pool
*/
public DefaultAllocationPool(IpAddress startIp, IpAddress endIp) {
checkNotNull(startIp, "StartIp cannot be null");
checkNotNull(endIp, "EndIp cannot be null");
this.startIp = startIp;
this.endIp = endIp;
}
@Override
public IpAddress startIp() {
return startIp;
}
@Override
public IpAddress endIp() {
return endIp;
}
@Override
public int hashCode() {
return Objects.hash(startIp, endIp);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultAllocationPool) {
final DefaultAllocationPool other = (DefaultAllocationPool) obj;
return Objects.equals(this.startIp, other.startIp)
&& Objects.equals(this.endIp, other.endIp);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("startIp", startIp).add("endIp", endIp)
.toString();
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
/**
* Host route dictionaries for the subnet.
*/
public final class DefaultHostRoute implements HostRoute {
private final IpAddress nexthop;
private final IpPrefix destination;
/**
*
* Creates a DefaultHostRoute by using the next hop and the destination.
*
* @param nexthop of the DefaultHostRoute
* @param destination of the DefaultHostRoute
*/
public DefaultHostRoute(IpAddress nexthop, IpPrefix destination) {
this.nexthop = nexthop;
this.destination = destination;
}
@Override
public IpAddress nexthop() {
return nexthop;
}
@Override
public IpPrefix destination() {
return destination;
}
@Override
public String toString() {
return toStringHelper(this).add("nexthop", nexthop)
.add("destination", destination).toString();
}
@Override
public int hashCode() {
return Objects.hash(nexthop, destination);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultHostRoute) {
final DefaultHostRoute other = (DefaultHostRoute) obj;
return Objects.equals(this.nexthop, other.nexthop)
&& Objects.equals(this.destination, other.destination);
}
return false;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
/**
* Host route dictionaries for the subnet.
*/
public final class DefaultHostRoute implements HostRoute {
private final IpAddress nexthop;
private final IpPrefix destination;
/**
*
* Creates a DefaultHostRoute by using the next hop and the destination.
*
* @param nexthop of the DefaultHostRoute
* @param destination of the DefaultHostRoute
*/
public DefaultHostRoute(IpAddress nexthop, IpPrefix destination) {
this.nexthop = nexthop;
this.destination = destination;
}
@Override
public IpAddress nexthop() {
return nexthop;
}
@Override
public IpPrefix destination() {
return destination;
}
@Override
public String toString() {
return toStringHelper(this).add("nexthop", nexthop)
.add("destination", destination).toString();
}
@Override
public int hashCode() {
return Objects.hash(nexthop, destination);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultHostRoute) {
final DefaultHostRoute other = (DefaultHostRoute) obj;
return Objects.equals(this.nexthop, other.nexthop)
&& Objects.equals(this.destination, other.destination);
}
return false;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.packet.IpAddress;
/**
* Immutable representation of a IP address for the port, Include the IP address
* and subnet identity.
*/
public final class FixedIp {
private final SubnetId subnetId;
private final IpAddress ip;
// Public construction is prohibited
private FixedIp(SubnetId subnetId, IpAddress ip) {
checkNotNull(subnetId, "SubnetId cannot be null");
checkNotNull(ip, "IpAddress cannot be null");
this.subnetId = subnetId;
this.ip = ip;
}
/**
* Returns the FixedIp subnet identifier.
*
* @return subnet identifier
*/
public SubnetId subnetId() {
return subnetId;
}
/**
* Returns the FixedIp IP address.
*
* @return IP address
*/
public IpAddress ip() {
return ip;
}
/**
* Creates a fixed ip using the supplied fixedIp.
*
* @param subnetId subnet identity
* @param ip IP address
* @return FixedIp
*/
public static FixedIp fixedIp(SubnetId subnetId, IpAddress ip) {
return new FixedIp(subnetId, ip);
}
@Override
public int hashCode() {
return Objects.hash(subnetId, ip);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof FixedIp) {
final FixedIp that = (FixedIp) obj;
return Objects.equals(this.subnetId, that.subnetId)
&& Objects.equals(this.ip, that.ip);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("subnetId", subnetId).add("ip", ip)
.toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.packet.IpAddress;
/**
* Immutable representation of a IP address for the port, Include the IP address
* and subnet identity.
*/
public final class FixedIp {
private final SubnetId subnetId;
private final IpAddress ip;
// Public construction is prohibited
private FixedIp(SubnetId subnetId, IpAddress ip) {
checkNotNull(subnetId, "SubnetId cannot be null");
checkNotNull(ip, "IpAddress cannot be null");
this.subnetId = subnetId;
this.ip = ip;
}
/**
* Returns the FixedIp subnet identifier.
*
* @return subnet identifier
*/
public SubnetId subnetId() {
return subnetId;
}
/**
* Returns the FixedIp IP address.
*
* @return IP address
*/
public IpAddress ip() {
return ip;
}
/**
* Creates a fixed ip using the supplied fixedIp.
*
* @param subnetId subnet identity
* @param ip IP address
* @return FixedIp
*/
public static FixedIp fixedIp(SubnetId subnetId, IpAddress ip) {
return new FixedIp(subnetId, ip);
}
@Override
public int hashCode() {
return Objects.hash(subnetId, ip);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof FixedIp) {
final FixedIp that = (FixedIp) obj;
return Objects.equals(this.subnetId, that.subnetId)
&& Objects.equals(this.ip, that.ip);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("subnetId", subnetId).add("ip", ip)
.toString();
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
/**
* Host route dictionaries for the subnet.
*/
public interface HostRoute {
/**
* Returns the next hop address.
*
* @return next hop address
*/
IpAddress nexthop();
/**
* Returns the destination address.
*
* @return destination address
*/
IpPrefix destination();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
/**
* Host route dictionaries for the subnet.
*/
public interface HostRoute {
/**
* Returns the next hop address.
*
* @return next hop address
*/
IpAddress nexthop();
/**
* Returns the destination address.
*
* @return destination address
*/
IpPrefix destination();
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a physicalnetwork identity.
*/
public final class PhysicalNetwork {
private final String physicalnetwork;
// Public construction is prohibited
private PhysicalNetwork(String physicalnetwork) {
checkNotNull(physicalnetwork, "Physicalnetwork cannot be null");
this.physicalnetwork = physicalnetwork;
}
/**
* Creates a network id using the physicalnetwork.
*
* @param physicalnetwork network String
* @return physicalnetwork
*/
public static PhysicalNetwork physicalNetwork(String physicalnetwork) {
return new PhysicalNetwork(physicalnetwork);
}
/**
*
* @return physicalnetwork
*/
public String physicalnetwork() {
return physicalnetwork;
}
@Override
public int hashCode() {
return Objects.hash(physicalnetwork);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof PhysicalNetwork) {
final PhysicalNetwork that = (PhysicalNetwork) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.physicalnetwork,
that.physicalnetwork);
}
return false;
}
@Override
public String toString() {
return physicalnetwork;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a physical network identity.
*/
public final class PhysicalNetwork {
private final String physicalNetwork;
// Public construction is prohibited
private PhysicalNetwork(String physicalNetwork) {
checkNotNull(physicalNetwork, "PhysicalNetwork cannot be null");
this.physicalNetwork = physicalNetwork;
}
/**
* Creates a PhysicalNetwork object.
*
* @param physicalNetwork physical network
* @return physical network
*/
public static PhysicalNetwork physicalNetwork(String physicalNetwork) {
return new PhysicalNetwork(physicalNetwork);
}
/**
* Returns a physicalNetwork.
*
* @return physical network
*/
public String physicalNetwork() {
return physicalNetwork;
}
@Override
public int hashCode() {
return Objects.hash(physicalNetwork);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof PhysicalNetwork) {
final PhysicalNetwork that = (PhysicalNetwork) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.physicalNetwork,
that.physicalNetwork);
}
return false;
}
@Override
public String toString() {
return physicalNetwork;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a security group.
*/
public final class SecurityGroup {
private final String securityGroup;
/**
* Returns the securityGroup.
*
* @return securityGroup
*/
public String securityGroup() {
return securityGroup;
}
// Public construction is prohibited
private SecurityGroup(String securityGroup) {
checkNotNull(securityGroup, "SecurityGroup cannot be null");
this.securityGroup = securityGroup;
}
/**
* Creates a securityGroup using the supplied securityGroup.
*
* @param securityGroup security group
* @return securityGroup
*/
public static SecurityGroup securityGroup(String securityGroup) {
return new SecurityGroup(securityGroup);
}
@Override
public int hashCode() {
return Objects.hash(securityGroup);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SecurityGroup) {
final SecurityGroup that = (SecurityGroup) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.securityGroup, that.securityGroup);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("securityGroup", securityGroup)
.toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a security group.
*/
public final class SecurityGroup {
private final String securityGroup;
/**
* Returns the securityGroup.
*
* @return securityGroup
*/
public String securityGroup() {
return securityGroup;
}
// Public construction is prohibited
private SecurityGroup(String securityGroup) {
checkNotNull(securityGroup, "SecurityGroup cannot be null");
this.securityGroup = securityGroup;
}
/**
* Creates a securityGroup using the supplied securityGroup.
*
* @param securityGroup security group
* @return securityGroup
*/
public static SecurityGroup securityGroup(String securityGroup) {
return new SecurityGroup(securityGroup);
}
@Override
public int hashCode() {
return Objects.hash(securityGroup);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SecurityGroup) {
final SecurityGroup that = (SecurityGroup) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.securityGroup, that.securityGroup);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("securityGroup", securityGroup)
.toString();
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a Segmentation identifier.
*/
public final class SegmentationId {
private final String segmentationId;
// Public construction is prohibited
private SegmentationId(String segmentationId) {
checkNotNull(segmentationId, "SegmentationId cannot be null");
this.segmentationId = segmentationId;
}
/**
* Creates a SegmentationId object.
*
* @param segmentationId segmentation identifier
* @return SegmentationId
*/
public static SegmentationId segmentationId(String segmentationId) {
return new SegmentationId(segmentationId);
}
/**
* Returns the segmentation identifier.
*
* @return segmentationId
*/
public String segmentationId() {
return segmentationId;
}
@Override
public int hashCode() {
return Objects.hash(segmentationId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SegmentationId) {
final SegmentationId that = (SegmentationId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.segmentationId, that.segmentationId);
}
return false;
}
@Override
public String toString() {
return segmentationId;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a Segmentation identifier.
*/
public final class SegmentationId {
private final String segmentationId;
// Public construction is prohibited
private SegmentationId(String segmentationId) {
checkNotNull(segmentationId, "SegmentationId cannot be null");
this.segmentationId = segmentationId;
}
/**
* Creates a SegmentationId object.
*
* @param segmentationId segmentation identifier
* @return SegmentationId
*/
public static SegmentationId segmentationId(String segmentationId) {
return new SegmentationId(segmentationId);
}
/**
* Returns the segmentation identifier.
*
* @return segmentationId
*/
public String segmentationId() {
return segmentationId;
}
@Override
public int hashCode() {
return Objects.hash(segmentationId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SegmentationId) {
final SegmentationId that = (SegmentationId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.segmentationId, that.segmentationId);
}
return false;
}
@Override
public String toString() {
return segmentationId;
}
}
......
/*
*Copyright 2014 Open Networking Laboratory
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpAddress.Version;
import org.onlab.packet.IpPrefix;
/**
* Representation of a subnet.
*/
public interface Subnet {
/**
* Coarse classification of the type of the ipV6Mode.
*/
public enum Mode {
DHCPV6_STATEFUL, DHCPV6_STATELESS, SLAAC
}
/**
* Returns the subnet identifier.
*
* @return identifier
*/
SubnetId id();
/**
* Returns the name of the subnet.
*
* @return subnetName
*/
String subnetName();
/**
* Returns the network identifier.
*
* @return the network identifier
*/
TenantNetworkId networkId();
/**
* Returns tenant identifier.
*
* @return the tenant identifier
*/
TenantId tenantId();
/**
* Returns the IP version, which is 4 or 6.
*
* @return ipVersion
*/
Version ipVersion();
/**
* Returns the cidr.
*
* @return cidr
*/
IpPrefix cidr();
/**
* Returns the gateway IP address.
*
* @return gatewayIp
*/
IpAddress gatewayIp();
/**
* Returns true if DHCP is enabled and return false if DHCP is disabled.
*
* @return true or false
*/
boolean dhcpEnabled();
/**
* Indicates whether this tenantNetwork is shared across all tenants. By
* default, only administrative user can change this value.
*
* @return true or false
*/
boolean shared();
/**
* Returns a collection of hostRoutes.
*
* @return a collection of hostRoutes
*/
Iterable<HostRoute> hostRoutes();
/**
* Returns the ipV6AddressMode. A valid value is dhcpv6-stateful,
* dhcpv6-stateless, or slaac.
*
* @return ipV6AddressMode whose value is dhcpv6-stateful, dhcpv6-stateless
* or slaac
*/
Mode ipV6AddressMode();
/**
* Returns the ipV6RaMode.A valid value is dhcpv6-stateful,
* dhcpv6-stateless, or slaac.
*
* @return ipV6RaMode whose value is dhcpv6-stateful, dhcpv6-stateless or
* slaac
*/
Mode ipV6RaMode();
/**
* Returns a collection of allocation_pools.
*
* @return a collection of allocationPools
*/
Iterable<AllocationPool> allocationPools();
}
/*
*Copyright 2015 Open Networking Laboratory
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/
package org.onosproject.vtnrsc;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpAddress.Version;
import org.onlab.packet.IpPrefix;
/**
* Representation of a subnet.
*/
public interface Subnet {
/**
* Coarse classification of the type of the ipV6Mode.
*/
public enum Mode {
DHCPV6_STATEFUL, DHCPV6_STATELESS, SLAAC
}
/**
* Returns the subnet identifier.
*
* @return identifier
*/
SubnetId id();
/**
* Returns the name of the subnet.
*
* @return subnetName
*/
String subnetName();
/**
* Returns the network identifier.
*
* @return the network identifier
*/
TenantNetworkId networkId();
/**
* Returns tenant identifier.
*
* @return the tenant identifier
*/
TenantId tenantId();
/**
* Returns the IP version, which is 4 or 6.
*
* @return ipVersion
*/
Version ipVersion();
/**
* Returns the cidr.
*
* @return cidr
*/
IpPrefix cidr();
/**
* Returns the gateway IP address.
*
* @return gatewayIp
*/
IpAddress gatewayIp();
/**
* Returns true if DHCP is enabled and return false if DHCP is disabled.
*
* @return true or false
*/
boolean dhcpEnabled();
/**
* Indicates whether this tenantNetwork is shared across all tenants. By
* default, only administrative user can change this value.
*
* @return true or false
*/
boolean shared();
/**
* Returns a collection of hostRoutes.
*
* @return a collection of hostRoutes
*/
Iterable<HostRoute> hostRoutes();
/**
* Returns the ipV6AddressMode. A valid value is dhcpv6-stateful,
* dhcpv6-stateless, or slaac.
*
* @return ipV6AddressMode whose value is dhcpv6-stateful, dhcpv6-stateless
* or slaac
*/
Mode ipV6AddressMode();
/**
* Returns the ipV6RaMode.A valid value is dhcpv6-stateful,
* dhcpv6-stateless, or slaac.
*
* @return ipV6RaMode whose value is dhcpv6-stateful, dhcpv6-stateless or
* slaac
*/
Mode ipV6RaMode();
/**
* Returns a collection of allocation_pools.
*
* @return a collection of allocationPools
*/
Iterable<AllocationPool> allocationPools();
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* Immutable representation of a subnet identifier.
*/
public final class SubnetId {
private final String subnetId;
// Public construction is prohibited
private SubnetId(String subnetId) {
checkNotNull(subnetId, "SubnetId cannot be null");
this.subnetId = subnetId;
}
/**
* Creates a Subnet identifier.
*
* @param subnetId the subnet identifier
* @return the subnet identifier
*/
public static SubnetId subnetId(String subnetId) {
return new SubnetId(subnetId);
}
/**
* Returns the subnet identifier.
*
* @return the subnet identifier
*/
public String subnetId() {
return subnetId;
}
@Override
public int hashCode() {
return Objects.hash(subnetId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SubnetId) {
final SubnetId that = (SubnetId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.subnetId, that.subnetId);
}
return false;
}
@Override
public String toString() {
return subnetId;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* Immutable representation of a subnet identifier.
*/
public final class SubnetId {
private final String subnetId;
// Public construction is prohibited
private SubnetId(String subnetId) {
checkNotNull(subnetId, "SubnetId cannot be null");
this.subnetId = subnetId;
}
/**
* Creates a Subnet identifier.
*
* @param subnetId the subnet identifier
* @return the subnet identifier
*/
public static SubnetId subnetId(String subnetId) {
return new SubnetId(subnetId);
}
/**
* Returns the subnet identifier.
*
* @return the subnet identifier
*/
public String subnetId() {
return subnetId;
}
@Override
public int hashCode() {
return Objects.hash(subnetId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SubnetId) {
final SubnetId that = (SubnetId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.subnetId, that.subnetId);
}
return false;
}
@Override
public String toString() {
return subnetId;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a network identity.
*/
public final class TenantId {
private final String tenantid;
// Public construction is prohibited
private TenantId(String tenantid) {
this.tenantid = tenantid;
}
/**
* Creates a network id using the tenantid.
*
* @param tenantid network String
* @return TenantId
*/
public static TenantId tenantId(String tenantid) {
checkNotNull(tenantid, "Tenantid can not be null");
return new TenantId(tenantid);
}
/**
*
* @return tenantid
*/
public String tenantid() {
return tenantid;
}
@Override
public int hashCode() {
return Objects.hash(tenantid);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TenantId) {
final TenantId that = (TenantId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.tenantid, that.tenantid);
}
return false;
}
@Override
public String toString() {
return tenantid;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a tenant identifier.
*/
public final class TenantId {
private final String tenantId;
// Public construction is prohibited
private TenantId(String tenantId) {
this.tenantId = tenantId;
}
/**
* Creates a network id using the tenantid.
*
* @param tenantid network String
* @return TenantId
*/
public static TenantId tenantId(String tenantid) {
checkNotNull(tenantid, "Tenantid can not be null");
return new TenantId(tenantid);
}
/**
* Returns the tenant identifier.
*
* @return the tenant identifier
*/
public String tenantId() {
return tenantId;
}
@Override
public int hashCode() {
return Objects.hash(tenantId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TenantId) {
final TenantId that = (TenantId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.tenantId, that.tenantId);
}
return false;
}
@Override
public String toString() {
return tenantId;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
/**
* Representation of the tenantNetwork.
*/
public interface TenantNetwork {
/**
* Coarse classification of the state of the tenantNetwork.
*/
public enum State {
/**
* Signifies that a tenantNetwork is currently active.This state means
* that this network is available.
*/
ACTIVE,
/**
* Signifies that a tenantNetwork is currently built.
*/
BUILD,
/**
* Signifies that a tenantNetwork is currently unavailable.
*/
DOWN,
/**
* Signifies that a tenantNetwork is currently error.
*/
ERROR
}
/**
* Coarse classification of the type of the tenantNetwork.
*/
public enum Type {
/**
* Signifies that a tenantNetwork is local.
*/
LOCAL
}
/**
* Returns the tenantNetwork identifier.
*
* @return tenantNetwork identifier
*/
TenantNetworkId id();
/**
* Returns the tenantNetwork name.
*
* @return tenantNetwork name
*/
String name();
/**
* Returns the administrative state of the tenantNetwork,which is up(true)
* or down(false).
*
* @return true or false
*/
boolean adminStateUp();
/**
* Returns the tenantNetwork state.
*
* @return tenant network state
*/
State state();
/**
* Indicates whether this tenantNetwork is shared across all tenants. By
* default,only administrative user can change this value.
*
* @return true or false
*/
boolean shared();
/**
* Returns the UUID of the tenant that will own the tenantNetwork. This
* tenant can be different from the tenant that makes the create
* tenantNetwork request.
*
* @return tenantNetwork tenant identifier
*/
TenantId tenantId();
/**
* Returns the routerExternal.Indicates whether this network is externally
* accessible.
*
* @return true or false
*/
boolean routerExternal();
/**
* Returns the tenantNetwork Type.
*
* @return tenantNetwork Type
*/
Type type();
/**
* Returns the tenantNetwork physical network.
*
* @return tenantNetwork physical network
*/
PhysicalNetwork physicalNetwork();
/**
* Returns the tenantNetwork segmentation id.
*
* @return tenantNetwork segmentation id
*/
SegmentationId segmentationId();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
/**
* Representation of the tenantNetwork.
*/
public interface TenantNetwork {
/**
* Coarse classification of the state of the tenantNetwork.
*/
public enum State {
/**
* Signifies that a tenantNetwork is currently active.This state means
* that this network is available.
*/
ACTIVE,
/**
* Signifies that a tenantNetwork is currently built.
*/
BUILD,
/**
* Signifies that a tenantNetwork is currently unavailable.
*/
DOWN,
/**
* Signifies that a tenantNetwork is currently error.
*/
ERROR
}
/**
* Coarse classification of the type of the tenantNetwork.
*/
public enum Type {
/**
* Signifies that a tenantNetwork is local.
*/
LOCAL
}
/**
* Returns the tenantNetwork identifier.
*
* @return tenantNetwork identifier
*/
TenantNetworkId id();
/**
* Returns the tenantNetwork name.
*
* @return tenantNetwork name
*/
String name();
/**
* Returns the administrative state of the tenantNetwork,which is up(true)
* or down(false).
*
* @return true or false
*/
boolean adminStateUp();
/**
* Returns the tenantNetwork state.
*
* @return tenant network state
*/
State state();
/**
* Indicates whether this tenantNetwork is shared across all tenants. By
* default,only administrative user can change this value.
*
* @return true or false
*/
boolean shared();
/**
* Returns the UUID of the tenant that will own the tenantNetwork. This
* tenant can be different from the tenant that makes the create
* tenantNetwork request.
*
* @return the tenant identifier
*/
TenantId tenantId();
/**
* Returns the routerExternal.Indicates whether this network is externally
* accessible.
*
* @return true or false
*/
boolean routerExternal();
/**
* Returns the tenantNetwork Type.
*
* @return tenantNetwork Type
*/
Type type();
/**
* Returns the tenantNetwork physical network.
*
* @return tenantNetwork physical network
*/
PhysicalNetwork physicalNetwork();
/**
* Returns the tenantNetwork segmentation id.
*
* @return tenantNetwork segmentation id
*/
SegmentationId segmentationId();
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a tenantNetwork identity.
*/
public final class TenantNetworkId {
private final String networkId;
// Public construction is prohibited
private TenantNetworkId(String networkId) {
this.networkId = networkId;
}
/**
* Creates a TenantNetwork identifier.
*
* @param networkId tenantNetwork identify string
* @return the attached tenantNetwork identifier
*/
public static TenantNetworkId networkId(String networkId) {
checkNotNull(networkId, "Networkid cannot be null");
return new TenantNetworkId(networkId);
}
/**
* Returns tenantNetwork identifier.
*
* @return the tenantNetwork identifier
*/
public String networkId() {
return networkId;
}
@Override
public int hashCode() {
return Objects.hash(networkId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TenantNetworkId) {
final TenantNetworkId that = (TenantNetworkId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.networkId, that.networkId);
}
return false;
}
@Override
public String toString() {
return networkId;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Immutable representation of a tenantNetwork identity.
*/
public final class TenantNetworkId {
private final String networkId;
// Public construction is prohibited
private TenantNetworkId(String networkId) {
this.networkId = networkId;
}
/**
* Creates a TenantNetwork identifier.
*
* @param networkId tenantNetwork identify string
* @return the attached tenantNetwork identifier
*/
public static TenantNetworkId networkId(String networkId) {
checkNotNull(networkId, "Networkid cannot be null");
return new TenantNetworkId(networkId);
}
/**
* Returns tenantNetwork identifier.
*
* @return the tenantNetwork identifier
*/
public String networkId() {
return networkId;
}
@Override
public int hashCode() {
return Objects.hash(networkId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TenantNetworkId) {
final TenantNetworkId that = (TenantNetworkId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.networkId, that.networkId);
}
return false;
}
@Override
public String toString() {
return networkId;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import java.util.Collection;
import org.onlab.packet.MacAddress;
import org.onosproject.net.DeviceId;
import org.onosproject.net.HostId;
/**
* Representation of the VirtualPort.
*/
public interface VirtualPort {
/**
* Coarse classification of the type of the virtual port.
*/
public enum State {
/**
* Signifies that a virtualPort is currently active,This state mean that
* this virtualPort is available.
*/
ACTIVE,
/**
* Signifies that a virtualPort is currently unavailable.
*/
DOWN;
}
/**
* Returns the virtualPort identifier.
*
* @return virtualPort identifier
*/
VirtualPortId portId();
/**
* Returns the network identifier.
*
* @return tenantNetwork identifier
*/
TenantNetworkId networkId();
/**
* Returns the symbolic name for the virtualPort.
*
* @return virtualPort name
*/
String name();
/**
* Returns the administrative status of the port,which is up(true) or
* down(false).
*
* @return true if the administrative status of the port is up
*/
boolean adminStateUp();
/**
* Returns the state.
*
* @return state
*/
State state();
/**
* Returns the MAC address.
*
* @return MAC Address
*/
MacAddress macAddress();
/**
* Returns the port tenantId.
*
* @return port tenantId
*/
TenantId tenantId();
/**
* Returns the device identifier.
*
* @return deviceId
*/
DeviceId deviceId();
/**
* Returns the identifier of the entity that uses this port.
*
* @return deviceOwner
*/
String deviceOwner();
/**
* Returns the virtualPort allowedAddressPairs.
*
* @return virtualPort allowedAddressPairs
*/
Collection<AllowedAddressPair> allowedAddressPairs();
/**
* Returns the IP address for the port, Include the IP address and subnet
* identity.
*
* @return port fixedIps
*/
FixedIp fixedIps();
/**
* Returns the virtualPort bindinghostId.
*
* @return virtualPort bindinghostId
*/
HostId bindingHostId();
/**
* Returns the virtualPort bindingVnicType.
*
* @return virtualPort bindingVnicType
*/
String bindingVnicType();
/**
* Returns the virtualPort bindingVifType.
*
* @return virtualPort bindingVifType
*/
String bindingVifType();
/**
* Returns the virtualPort bindingvifDetail.
*
* @return virtualPort bindingvifDetail
*/
String bindingVifDetails();
/**
* Returns the security groups.
*
* @return port security groups
*/
Iterable<SecurityGroup> securityGroups();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import java.util.Collection;
import java.util.Set;
import org.onlab.packet.MacAddress;
import org.onosproject.net.DeviceId;
/**
* Representation of the VirtualPort.
*/
public interface VirtualPort {
/**
* Coarse classification of the type of the virtual port.
*/
public enum State {
/**
* Signifies that a virtualPort is currently active,This state mean that
* this virtualPort is available.
*/
ACTIVE,
/**
* Signifies that a virtualPort is currently unavailable.
*/
DOWN;
}
/**
* Returns the virtualPort identifier.
*
* @return virtualPort identifier
*/
VirtualPortId portId();
/**
* Returns the network identifier.
*
* @return tenantNetwork identifier
*/
TenantNetworkId networkId();
/**
* Returns the symbolic name for the virtualPort.
*
* @return virtualPort name
*/
String name();
/**
* Returns the administrative status of the port,which is up(true) or
* down(false).
*
* @return true if the administrative status of the port is up
*/
boolean adminStateUp();
/**
* Returns the state.
*
* @return state
*/
State state();
/**
* Returns the MAC address.
*
* @return MAC Address
*/
MacAddress macAddress();
/**
* Returns the port tenantId.
*
* @return port tenantId
*/
TenantId tenantId();
/**
* Returns the device identifier.
*
* @return deviceId
*/
DeviceId deviceId();
/**
* Returns the identifier of the entity that uses this port.
*
* @return deviceOwner
*/
String deviceOwner();
/**
* Returns the virtualPort allowedAddressPairs.
*
* @return virtualPort allowedAddressPairs
*/
Collection<AllowedAddressPair> allowedAddressPairs();
/**
* Returns set of IP addresses for the port, include the IP addresses and subnet
* identity.
*
* @return FixedIps Set of fixedIp
*/
Set<FixedIp> fixedIps();
/**
* Returns the virtualPort bindinghostId.
*
* @return virtualPort bindinghostId
*/
BindingHostId bindingHostId();
/**
* Returns the virtualPort bindingVnicType.
*
* @return virtualPort bindingVnicType
*/
String bindingVnicType();
/**
* Returns the virtualPort bindingVifType.
*
* @return virtualPort bindingVifType
*/
String bindingVifType();
/**
* Returns the virtualPort bindingvifDetail.
*
* @return virtualPort bindingvifDetail
*/
String bindingVifDetails();
/**
* Returns the security groups.
*
* @return port security groups
*/
Iterable<SecurityGroup> securityGroups();
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* Immutable representation of a virtual port identifier.
*/
public final class VirtualPortId {
private final String portId;
// Public construction is prohibited
private VirtualPortId(String virtualPortId) {
checkNotNull(virtualPortId, "VirtualPortId cannot be null");
this.portId = virtualPortId;
}
public String portId() {
return portId;
}
/**
* Creates a virtualPort id using the supplied portId.
*
* @param portId virtualport identifier
* @return VirtualPortId
*/
public static VirtualPortId portId(String portId) {
return new VirtualPortId(portId);
}
@Override
public int hashCode() {
return Objects.hash(portId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof VirtualPortId) {
final VirtualPortId that = (VirtualPortId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.portId, that.portId);
}
return false;
}
@Override
public String toString() {
return portId;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* Immutable representation of a virtual port identifier.
*/
public final class VirtualPortId {
private final String portId;
// Public construction is prohibited
private VirtualPortId(String virtualPortId) {
checkNotNull(virtualPortId, "VirtualPortId cannot be null");
this.portId = virtualPortId;
}
public String portId() {
return portId;
}
/**
* Creates a virtualPort id using the supplied portId.
*
* @param portId virtualport identifier
* @return VirtualPortId
*/
public static VirtualPortId portId(String portId) {
return new VirtualPortId(portId);
}
@Override
public int hashCode() {
return Objects.hash(portId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof VirtualPortId) {
final VirtualPortId that = (VirtualPortId) obj;
return this.getClass() == that.getClass()
&& Objects.equals(this.portId, that.portId);
}
return false;
}
@Override
public String toString() {
return portId;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.subnet;
import org.onosproject.app.vtnrsc.Subnet;
import org.onosproject.app.vtnrsc.SubnetId;
/**
* Service for interacting with the inventory of subnets.
*/
public interface SubnetService {
/**
* Returns the subnet with the specified identifier.
*
* @param subnetId subnet identifier
* @return true or false
*/
boolean exists(SubnetId subnetId);
/**
* Returns a collection of the currently known subnets.
*
* @return iterable collection of subnets
*/
Iterable<Subnet> getSubnets();
/**
* Returns the subnet with the specified identifier.
*
* @param subnetId subnet identifier
* @return subnet or null if one with the given identifier is not known
*/
Subnet getSubnet(SubnetId subnetId);
/**
* Creates new subnets.
*
* @param subnets the iterable collection of subnets
* @return true if the identifier subnet has been created right
*/
boolean createSubnets(Iterable<Subnet> subnets);
/**
* Updates existing subnets.
*
* @param subnets the iterable collection of subnets
* @return true if all subnets were updated successfully
*/
boolean updateSubnets(Iterable<Subnet> subnets);
/**
* Administratively removes the specified subnets from the store.
*
* @param subnetIds the iterable collection of subnets identifier
* @return true if remove identifier subnets successfully
*/
boolean removeSubnets(Iterable<SubnetId> subnetIds);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.subnet;
import org.onosproject.vtnrsc.Subnet;
import org.onosproject.vtnrsc.SubnetId;
/**
* Service for interacting with the inventory of subnets.
*/
public interface SubnetService {
/**
* Returns the subnet with the specified identifier.
*
* @param subnetId subnet identifier
* @return true or false
*/
boolean exists(SubnetId subnetId);
/**
* Returns a collection of the currently known subnets.
*
* @return iterable collection of subnets
*/
Iterable<Subnet> getSubnets();
/**
* Returns the subnet with the specified identifier.
*
* @param subnetId subnet identifier
* @return subnet or null if one with the given identifier is not known
*/
Subnet getSubnet(SubnetId subnetId);
/**
* Creates new subnets.
*
* @param subnets the iterable collection of subnets
* @return true if the identifier subnet has been created right
*/
boolean createSubnets(Iterable<Subnet> subnets);
/**
* Updates existing subnets.
*
* @param subnets the iterable collection of subnets
* @return true if all subnets were updated successfully
*/
boolean updateSubnets(Iterable<Subnet> subnets);
/**
* Administratively removes the specified subnets from the store.
*
* @param subnetIds the iterable collection of subnets identifier
* @return true if remove identifier subnets successfully
*/
boolean removeSubnets(Iterable<SubnetId> subnetIds);
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.tenantnetwork;
import org.onosproject.app.vtnrsc.TenantNetwork;
import org.onosproject.app.vtnrsc.TenantNetworkId;
/**
* Service for interacting with the inventory of tenantNetwork.
*/
public interface TenantNetworkService {
/**
* Returns if the tenantNetwork is existed.
*
* @param networkId tenantNetwork identifier
* @return true or false if one with the given identifier exists.
*/
boolean exists(TenantNetworkId networkId);
/**
* Returns the number of tenantNetwork known to the system.
*
* @return number of tenantNetwork.
*/
int getNetworkCount();
/**
* Returns an iterable collection of the currently known tenantNetwork.
*
* @return collection of tenantNetwork.
*/
Iterable<TenantNetwork> getNetworks();
/**
* Returns the tenantNetwork with the identifier.
*
* @param networkId TenantNetwork identifier
* @return TenantNetwork or null if one with the given identifier is not
* known.
*/
TenantNetwork getNetwork(TenantNetworkId networkId);
/**
* Creates tenantNetworks by networks.
*
* @param networks the collection of tenantNetworks
* @return true if all given identifiers created successfully.
*/
boolean createNetworks(Iterable<TenantNetwork> networks);
/**
* Updates tenantNetworks by tenantNetworks.
*
* @param networks the collection of tenantNetworks
* @return true if all given identifiers updated successfully.
*/
boolean updateNetworks(Iterable<TenantNetwork> networks);
/**
* Deletes tenantNetwork by tenantNetworkIds.
*
* @param networksId the collection of tenantNetworkIds
* @return true if the specified tenantNetwork deleted successfully.
*/
boolean removeNetworks(Iterable<TenantNetworkId> networksId);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.tenantnetwork;
import org.onosproject.vtnrsc.TenantNetwork;
import org.onosproject.vtnrsc.TenantNetworkId;
/**
* Service for interacting with the inventory of tenantNetwork.
*/
public interface TenantNetworkService {
/**
* Returns if the tenantNetwork is existed.
*
* @param networkId tenantNetwork identifier
* @return true or false if one with the given identifier exists.
*/
boolean exists(TenantNetworkId networkId);
/**
* Returns the number of tenantNetwork known to the system.
*
* @return number of tenantNetwork.
*/
int getNetworkCount();
/**
* Returns an iterable collection of the currently known tenantNetwork.
*
* @return collection of tenantNetwork.
*/
Iterable<TenantNetwork> getNetworks();
/**
* Returns the tenantNetwork with the identifier.
*
* @param networkId TenantNetwork identifier
* @return TenantNetwork or null if one with the given identifier is not
* known.
*/
TenantNetwork getNetwork(TenantNetworkId networkId);
/**
* Creates tenantNetworks by networks.
*
* @param networks the collection of tenantNetworks
* @return true if all given identifiers created successfully.
*/
boolean createNetworks(Iterable<TenantNetwork> networks);
/**
* Updates tenantNetworks by tenantNetworks.
*
* @param networks the collection of tenantNetworks
* @return true if all given identifiers updated successfully.
*/
boolean updateNetworks(Iterable<TenantNetwork> networks);
/**
* Deletes tenantNetwork by tenantNetworkIds.
*
* @param networksIds the collection of tenantNetworkIds
* @return true if the specified tenantNetworks deleted successfully.
*/
boolean removeNetworks(Iterable<TenantNetworkId> networksIds);
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.tenantnetwork.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Collections;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.util.KryoNamespace;
import org.onosproject.app.vtnrsc.TenantNetwork;
import org.onosproject.app.vtnrsc.TenantNetworkId;
import org.onosproject.app.vtnrsc.tenantnetwork.TenantNetworkService;
import org.onosproject.store.service.EventuallyConsistentMap;
import org.onosproject.store.service.MultiValuedTimestamp;
import org.onosproject.store.service.StorageService;
import org.onosproject.store.service.WallClockTimestamp;
import org.slf4j.Logger;
/**
* Provides implementation of the tenantNetworkService.
*/
@Component(immediate = true)
@Service
public class TenantNetworkManager implements TenantNetworkService {
private static final String NETWORK_ID_NULL = "Network ID cannot be null";
private static final String NETWORK_NOT_NULL = "Network ID cannot be null";
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected StorageService storageService;
private EventuallyConsistentMap<TenantNetworkId, TenantNetwork> networkIdAsKeyStore;
private final Logger log = getLogger(getClass());
@Activate
public void activate() {
KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
.register(MultiValuedTimestamp.class);
networkIdAsKeyStore = storageService
.<TenantNetworkId, TenantNetwork>eventuallyConsistentMapBuilder()
.withName("all_network").withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp())
.build();
log.info("Started");
}
@Deactivate
public void deactivate() {
networkIdAsKeyStore.destroy();
log.info("Stopped");
}
@Override
public boolean exists(TenantNetworkId networkId) {
checkNotNull(networkId, NETWORK_ID_NULL);
return networkIdAsKeyStore.containsKey(networkId);
}
@Override
public int getNetworkCount() {
return networkIdAsKeyStore.size();
}
@Override
public Iterable<TenantNetwork> getNetworks() {
return Collections.unmodifiableCollection(networkIdAsKeyStore.values());
}
@Override
public TenantNetwork getNetwork(TenantNetworkId networkId) {
checkNotNull(networkId, NETWORK_ID_NULL);
return networkIdAsKeyStore.get(networkId);
}
@Override
public boolean createNetworks(Iterable<TenantNetwork> networks) {
checkNotNull(networks, NETWORK_NOT_NULL);
for (TenantNetwork network : networks) {
networkIdAsKeyStore.put(network.id(), network);
if (!networkIdAsKeyStore.containsKey(network.id())) {
log.debug("the network created failed which identifier was {}", network.id()
.toString());
return false;
}
}
return true;
}
@Override
public boolean updateNetworks(Iterable<TenantNetwork> networks) {
checkNotNull(networks, NETWORK_NOT_NULL);
for (TenantNetwork network : networks) {
if (!networkIdAsKeyStore.containsKey(network.id())) {
log.debug("the tenantNetwork did not exist whose identifier was {} ",
network.id().toString());
return false;
}
networkIdAsKeyStore.put(network.id(), network);
if (network.equals(networkIdAsKeyStore.get(network.id()))) {
log.debug("the network updated failed whose identifier was {} ",
network.id().toString());
return false;
}
}
return true;
}
@Override
public boolean removeNetworks(Iterable<TenantNetworkId> networkIds) {
checkNotNull(networkIds, NETWORK_NOT_NULL);
for (TenantNetworkId networkId : networkIds) {
networkIdAsKeyStore.remove(networkId);
if (networkIdAsKeyStore.containsKey(networkId)) {
log.debug("the network removed failed whose identifier was {}",
networkId.toString());
return false;
}
}
return true;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.tenantnetwork.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.onosproject.vtnrsc.TenantNetwork;
import org.onosproject.vtnrsc.TenantNetworkId;
import org.onosproject.vtnrsc.tenantnetwork.TenantNetworkService;
import org.slf4j.Logger;
/**
* Provides implementation of the tenantNetworkService.
*/
@Component(immediate = true)
@Service
public class TenantNetworkManager implements TenantNetworkService {
private static final String NETWORK_ID_NULL = "Network ID cannot be null";
private static final String NETWORK_NOT_NULL = "Network ID cannot be null";
protected ConcurrentHashMap<TenantNetworkId, TenantNetwork> networkIdAsKeyStore =
new ConcurrentHashMap<>();
private final Logger log = getLogger(getClass());
@Activate
public void activate() {
log.info("Started");
}
@Deactivate
public void deactivate() {
networkIdAsKeyStore.clear();
log.info("Stopped");
}
@Override
public boolean exists(TenantNetworkId networkId) {
checkNotNull(networkId, NETWORK_ID_NULL);
return networkIdAsKeyStore.containsKey(networkId);
}
@Override
public int getNetworkCount() {
return networkIdAsKeyStore.size();
}
@Override
public Iterable<TenantNetwork> getNetworks() {
return Collections.unmodifiableCollection(networkIdAsKeyStore.values());
}
@Override
public TenantNetwork getNetwork(TenantNetworkId networkId) {
checkNotNull(networkId, NETWORK_ID_NULL);
return networkIdAsKeyStore.get(networkId);
}
@Override
public boolean createNetworks(Iterable<TenantNetwork> networks) {
checkNotNull(networks, NETWORK_NOT_NULL);
for (TenantNetwork network : networks) {
networkIdAsKeyStore.put(network.id(), network);
if (!networkIdAsKeyStore.containsKey(network.id())) {
log.debug("The tenantNetwork is created failed which identifier was {}", network.id()
.toString());
return false;
}
}
return true;
}
@Override
public boolean updateNetworks(Iterable<TenantNetwork> networks) {
checkNotNull(networks, NETWORK_NOT_NULL);
for (TenantNetwork network : networks) {
if (!networkIdAsKeyStore.containsKey(network.id())) {
log.debug("The tenantNetwork is not exist whose identifier was {} ",
network.id().toString());
return false;
}
networkIdAsKeyStore.put(network.id(), network);
if (!network.equals(networkIdAsKeyStore.get(network.id()))) {
log.debug("The tenantNetwork is updated failed whose identifier was {} ",
network.id().toString());
return false;
}
}
return true;
}
@Override
public boolean removeNetworks(Iterable<TenantNetworkId> networkIds) {
checkNotNull(networkIds, NETWORK_NOT_NULL);
for (TenantNetworkId networkId : networkIds) {
networkIdAsKeyStore.remove(networkId);
if (networkIdAsKeyStore.containsKey(networkId)) {
log.debug("The tenantNetwork is removed failed whose identifier was {}",
networkId.toString());
return false;
}
}
return true;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.tunnel;
import org.onosproject.vtnrsc.Subnet;
import org.onosproject.vtnrsc.SubnetId;
/**
* Service for interacting with the inventory of subnets.
*/
public interface TunnelConfigService {
/**
* Returns the subnet with the specified identifier.
*
* @param subnetId subnet identifier
* @return true or false
*/
boolean exists(SubnetId subnetId);
/**
* Returns a collection of the currently known subnets.
*
* @return iterable collection of subnets
*/
Iterable<Subnet> getSubnets();
/**
* Returns the subnet with the specified identifier.
*
* @param subnetId subnet identifier
* @return subnet or null if one with the given identifier is not known
*/
Subnet getSubnet(SubnetId subnetId);
/**
* Creates new subnets.
*
* @param subnets the iterable collection of subnets
* @return true if the identifier subnet has been created right
*/
boolean createSubnets(Iterable<Subnet> subnets);
/**
* Updates existing subnets.
*
* @param subnets the iterable collection of subnets
* @return true if all subnets were updated successfully
*/
boolean updateSubnets(Iterable<Subnet> subnets);
/**
* Administratively removes the specified subnets from the store.
*
* @param subnetIds the iterable collection of subnets identifier
* @return true if remove identifier subnets successfully
*/
boolean removeSubnets(Iterable<SubnetId> subnetIds);
}
/*
* Copyright 2015 Open Porting Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.virtualport;
import java.util.Collection;
import org.onosproject.app.vtnrsc.TenantNetworkId;
import org.onosproject.app.vtnrsc.TenantId;
import org.onosproject.app.vtnrsc.VirtualPort;
import org.onosproject.app.vtnrsc.VirtualPortId;
import org.onosproject.net.DeviceId;
/**
* Service for interacting with the inventory of virtualPort.
*/
public interface VirtualPortService {
/**
* Returns if the virtualPort is existed.
*
* @param virtualPortId virtualPort identifier
* @return true or false if one with the given identifier is not existed.
*/
boolean exists(VirtualPortId virtualPortId);
/**
* Returns the virtualPort with the identifier.
*
* @param virtualPortId virtualPort ID
* @return VirtualPort or null if one with the given ID is not know.
*/
VirtualPort getPort(VirtualPortId virtualPortId);
/**
* Returns the collection of the currently known virtualPort.
*/
Collection<VirtualPort> getPorts();
/**
* Returns the collection of the virtualPorts associated with the networkId.
*
* @param networkId the network identifer
* @return collection of virtualPort.
*/
Collection<VirtualPort> getPorts(TenantNetworkId networkId);
/**
* Returns the collection of the virtualPorts associated with the tenantId.
*
* @param tenantId the tenant identifier
* @return collection of virtualPorts.
*/
Collection<VirtualPort> getPorts(TenantId tenantId);
/**
* Returns the collection of the virtualPorts associated with the deviceId.
*
* @param deviceId the device identifier
* @return collection of virtualPort.
*/
Collection<VirtualPort> getPorts(DeviceId deviceId);
/**
* Creates virtualPorts by virtualPorts.
*
* @param virtualPorts the iterable collection of virtualPorts
* @return true if all given identifiers created successfully.
*/
boolean createPorts(Iterable<VirtualPort> virtualPorts);
/**
* Updates virtualPorts by virtualPorts.
*
* @param virtualPorts the iterable collection of virtualPorts
* @return true if all given identifiers updated successfully.
*/
boolean updatePorts(Iterable<VirtualPort> virtualPorts);
/**
* Deletes virtualPortIds by virtualPortIds.
*
* @param virtualPortIds the iterable collection of virtualPort identifiers
* @return true or false if one with the given identifier to delete is
* successfully.
*/
boolean removePorts(Iterable<VirtualPortId> virtualPortIds);
}
/*
* Copyright 2015 Open Porting Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.virtualport;
import java.util.Collection;
import org.onosproject.net.DeviceId;
import org.onosproject.vtnrsc.TenantId;
import org.onosproject.vtnrsc.TenantNetworkId;
import org.onosproject.vtnrsc.VirtualPort;
import org.onosproject.vtnrsc.VirtualPortId;
/**
* Service for interacting with the inventory of virtualPort.
*/
public interface VirtualPortService {
/**
* Returns if the virtualPort is existed.
*
* @param virtualPortId virtualPort identifier
* @return true or false if one with the given identifier is not existed.
*/
boolean exists(VirtualPortId virtualPortId);
/**
* Returns the virtualPort with the identifier.
*
* @param virtualPortId virtualPort ID
* @return VirtualPort or null if one with the given ID is not know.
*/
VirtualPort getPort(VirtualPortId virtualPortId);
/**
* Returns the collection of the currently known virtualPort.
* @return collection of VirtualPort.
*/
Collection<VirtualPort> getPorts();
/**
* Returns the collection of the virtualPorts associated with the networkId.
*
* @param networkId the network identifer
* @return collection of virtualPort.
*/
Collection<VirtualPort> getPorts(TenantNetworkId networkId);
/**
* Returns the collection of the virtualPorts associated with the tenantId.
*
* @param tenantId the tenant identifier
* @return collection of virtualPorts.
*/
Collection<VirtualPort> getPorts(TenantId tenantId);
/**
* Returns the collection of the virtualPorts associated with the deviceId.
*
* @param deviceId the device identifier
* @return collection of virtualPort.
*/
Collection<VirtualPort> getPorts(DeviceId deviceId);
/**
* Creates virtualPorts by virtualPorts.
*
* @param virtualPorts the iterable collection of virtualPorts
* @return true if all given identifiers created successfully.
*/
boolean createPorts(Iterable<VirtualPort> virtualPorts);
/**
* Updates virtualPorts by virtualPorts.
*
* @param virtualPorts the iterable collection of virtualPorts
* @return true if all given identifiers updated successfully.
*/
boolean updatePorts(Iterable<VirtualPort> virtualPorts);
/**
* Deletes virtualPortIds by virtualPortIds.
*
* @param virtualPortIds the iterable collection of virtualPort identifiers
* @return true or false if one with the given identifier to delete is
* successfully.
*/
boolean removePorts(Iterable<VirtualPortId> virtualPortIds);
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.app.vtnrsc.AllocationPool;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Subnet AllocationPool codec.
*/
public final class AllocationPoolsCodec extends JsonCodec<AllocationPool> {
@Override
public ObjectNode encode(AllocationPool alocPool, CodecContext context) {
checkNotNull(alocPool, "AllocationPools cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("start", alocPool.startIp().toString())
.put("end", alocPool.endIp().toString());
return result;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.vtnrsc.AllocationPool;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Subnet AllocationPool codec.
*/
public final class AllocationPoolsCodec extends JsonCodec<AllocationPool> {
@Override
public ObjectNode encode(AllocationPool alocPool, CodecContext context) {
checkNotNull(alocPool, "AllocationPools cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("start", alocPool.startIp().toString())
.put("end", alocPool.endIp().toString());
return result;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.app.vtnrsc.AllowedAddressPair;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* VirtualPort AllowedAddressPair codec.
*/
public final class AllowedAddressPairCodec extends JsonCodec<AllowedAddressPair> {
@Override
public ObjectNode encode(AllowedAddressPair alocAddPair, CodecContext context) {
checkNotNull(alocAddPair, "AllowedAddressPair cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("ip_address", alocAddPair.ip().toString())
.put("mac_address", alocAddPair.mac().toString());
return result;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.vtnrsc.AllowedAddressPair;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* VirtualPort AllowedAddressPair codec.
*/
public final class AllowedAddressPairCodec extends JsonCodec<AllowedAddressPair> {
@Override
public ObjectNode encode(AllowedAddressPair alocAddPair, CodecContext context) {
checkNotNull(alocAddPair, "AllowedAddressPair cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("ip_address", alocAddPair.ip().toString())
.put("mac_address", alocAddPair.mac().toString());
return result;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.app.vtnrsc.FixedIp;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* VirtualPort FixedIp codec.
*/
public final class FixedIpCodec extends JsonCodec<FixedIp> {
@Override
public ObjectNode encode(FixedIp fixIp, CodecContext context) {
checkNotNull(fixIp, "FixedIp cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("subnet_id", fixIp.subnetId().toString())
.put("ip_address", fixIp.ip().toString());
return result;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.vtnrsc.FixedIp;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* VirtualPort FixedIp codec.
*/
public final class FixedIpCodec extends JsonCodec<FixedIp> {
@Override
public ObjectNode encode(FixedIp fixIp, CodecContext context) {
checkNotNull(fixIp, "FixedIp cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("subnet_id", fixIp.subnetId().toString())
.put("ip_address", fixIp.ip().toString());
return result;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.app.vtnrsc.HostRoute;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Subnet HostRoute codec.
*/
public final class HostRoutesCodec extends JsonCodec<HostRoute> {
@Override
public ObjectNode encode(HostRoute hostRoute, CodecContext context) {
checkNotNull(hostRoute, "HostRoute cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("nexthop", hostRoute.nexthop().toString())
.put("destination", hostRoute.destination().toString());
return result;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.vtnrsc.HostRoute;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Subnet HostRoute codec.
*/
public final class HostRoutesCodec extends JsonCodec<HostRoute> {
@Override
public ObjectNode encode(HostRoute hostRoute, CodecContext context) {
checkNotNull(hostRoute, "HostRoute cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("nexthop", hostRoute.nexthop().toString())
.put("destination", hostRoute.destination().toString());
return result;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.app.vtnrsc.SecurityGroup;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Virtualport SecurityGroup codec.
*/
public final class SecurityGroupCodec extends JsonCodec<SecurityGroup> {
@Override
public ObjectNode encode(SecurityGroup securGroup, CodecContext context) {
checkNotNull(securGroup, "SecurityGroup cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("security_group", securGroup.securityGroup());
return result;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.vtnrsc.SecurityGroup;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Virtualport SecurityGroup codec.
*/
public final class SecurityGroupCodec extends JsonCodec<SecurityGroup> {
@Override
public ObjectNode encode(SecurityGroup securGroup, CodecContext context) {
checkNotNull(securGroup, "SecurityGroup cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("security_group", securGroup.securityGroup());
return result;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.app.vtnrsc.Subnet;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Subnet JSON codec.
*/
public final class SubnetCodec extends JsonCodec<Subnet> {
@Override
public ObjectNode encode(Subnet subnet, CodecContext context) {
checkNotNull(subnet, "Subnet cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("id", subnet.id().toString())
.put("gate_ip", subnet.gatewayIp().toString())
.put("network_id", subnet.networkId().toString())
.put("name", subnet.subnetName().toString())
.put("ip_version", subnet.ipVersion().toString())
.put("cidr", subnet.cidr().toString())
.put("shared", subnet.shared())
.put("enabled_dchp", subnet.dhcpEnabled())
.put("tenant_id", subnet.tenantId().toString());
result.set("alloction_pools", new AllocationPoolsCodec().encode(subnet
.allocationPools(), context));
result.set("host_routes",
new HostRoutesCodec().encode(subnet.hostRoutes(), context));
return result;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.vtnrsc.Subnet;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* Subnet JSON codec.
*/
public final class SubnetCodec extends JsonCodec<Subnet> {
@Override
public ObjectNode encode(Subnet subnet, CodecContext context) {
checkNotNull(subnet, "Subnet cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("id", subnet.id().toString())
.put("gate_ip", subnet.gatewayIp().toString())
.put("network_id", subnet.networkId().toString())
.put("name", subnet.subnetName().toString())
.put("ip_version", subnet.ipVersion().toString())
.put("cidr", subnet.cidr().toString())
.put("shared", subnet.shared())
.put("enabled_dchp", subnet.dhcpEnabled())
.put("tenant_id", subnet.tenantId().toString());
result.set("alloction_pools", new AllocationPoolsCodec().encode(subnet
.allocationPools(), context));
result.set("host_routes",
new HostRoutesCodec().encode(subnet.hostRoutes(), context));
return result;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.app.vtnrsc.TenantNetwork;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* TenantNetwork JSON codec.
*/
public final class TenantNetworkCodec extends JsonCodec<TenantNetwork> {
@Override
public ObjectNode encode(TenantNetwork network, CodecContext context) {
checkNotNull(network, "Network cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("id", network.id().toString())
.put("name", network.name().toString())
.put("admin_state_up", network.adminStateUp())
.put("status", "" + network.state())
.put("shared", network.shared())
.put("tenant_id", network.tenantId().toString())
.put("router:external", network.routerExternal())
.put("provider:network_type", "" + network.type())
.put("provider:physical_network", network.physicalNetwork().toString())
.put("provider:segmentation_id", network.segmentationId().toString());
return result;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.vtnrsc.TenantNetwork;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* TenantNetwork JSON codec.
*/
public final class TenantNetworkCodec extends JsonCodec<TenantNetwork> {
@Override
public ObjectNode encode(TenantNetwork network, CodecContext context) {
checkNotNull(network, "Network cannot be null");
ObjectNode result = context.mapper().createObjectNode()
.put("id", network.id().toString())
.put("name", network.name().toString())
.put("admin_state_up", network.adminStateUp())
.put("status", "" + network.state())
.put("shared", network.shared())
.put("tenant_id", network.tenantId().toString())
.put("router:external", network.routerExternal())
.put("provider:network_type", "" + network.type())
.put("provider:physical_network", network.physicalNetwork().toString())
.put("provider:segmentation_id", network.segmentationId().toString());
return result;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.app.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.app.vtnrsc.VirtualPort;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* VirtualPort JSON codec.
*/
public final class VirtualPortCodec extends JsonCodec<VirtualPort> {
@Override
public ObjectNode encode(VirtualPort vPort, CodecContext context) {
checkNotNull(vPort, "VPort cannot be null");
ObjectNode result = context
.mapper()
.createObjectNode()
.put("id", vPort.portId().toString())
.put("network_id", vPort.networkId().toString())
.put("admin_state_up", vPort.adminStateUp())
.put("name", vPort.name().toString())
.put("status", vPort.state().toString())
.put("mac_address", vPort.macAddress().toString())
.put("tenant_id", vPort.tenantId().toString())
.put("device_id", vPort.deviceId().toString())
.put("device_owner", vPort.deviceOwner().toString())
.put("binding:vnic_type", vPort.bindingVnicType().toString())
.put("binding:Vif_type", vPort.bindingVifType().toString())
.put("binding:host_id", vPort.bindingHostId().mac().toString())
.put("binding:vif_details", vPort.bindingVifDetails().toString());
result.set("allowed_address_pairs", new AllowedAddressPairCodec().encode(
vPort.allowedAddressPairs(), context));
result.set("fixed_ips", new FixedIpCodec().encode(
vPort.fixedIps(), context));
result.set("security_groups", new SecurityGroupCodec().encode(
vPort.securityGroups(), context));
return result;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.web;
import static com.google.common.base.Preconditions.checkNotNull;
import org.onosproject.codec.CodecContext;
import org.onosproject.codec.JsonCodec;
import org.onosproject.vtnrsc.VirtualPort;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* VirtualPort JSON codec.
*/
public final class VirtualPortCodec extends JsonCodec<VirtualPort> {
@Override
public ObjectNode encode(VirtualPort vPort, CodecContext context) {
checkNotNull(vPort, "VPort cannot be null");
ObjectNode result = context
.mapper()
.createObjectNode()
.put("id", vPort.portId().toString())
.put("network_id", vPort.networkId().toString())
.put("admin_state_up", vPort.adminStateUp())
.put("name", vPort.name().toString())
.put("status", vPort.state().toString())
.put("mac_address", vPort.macAddress().toString())
.put("tenant_id", vPort.tenantId().toString())
.put("device_id", vPort.deviceId().toString())
.put("device_owner", vPort.deviceOwner().toString())
.put("binding:vnic_type", vPort.bindingVnicType().toString())
.put("binding:Vif_type", vPort.bindingVifType().toString())
.put("binding:host_id", vPort.bindingHostId().toString())
.put("binding:vif_details", vPort.bindingVifDetails().toString());
result.set("allowed_address_pairs", new AllowedAddressPairCodec().encode(
vPort.allowedAddressPairs(), context));
result.set("fixed_ips", new FixedIpCodec().encode(
vPort.fixedIps(), context));
result.set("security_groups", new SecurityGroupCodec().encode(
vPort.securityGroups(), context));
return result;
}
}
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright 2015 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
<repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository>
<feature name="onos-app-vtnweb" version="@FEATURE-VERSION"
description="ONOS app vtnweb components">
<feature>onos-app-vtnrsc</feature>
<bundle>mvn:org.onosproject/vtnweb/@ONOS-VERSION
</bundle>
</feature>
</features>