Satish K
Committed by Gerrit Code Review

Application manages the IP layer topology information - Interfaces

Change-Id: Ie1dea035674ee98583e98a82cca7e33ab0858b92
Showing 68 changed files with 4792 additions and 0 deletions
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-apps</artifactId>
<version>1.4.0-SNAPSHOT</version>
</parent>
<artifactId>onos-app-iptopology-api</artifactId>
<packaging>bundle</packaging>
<description>IP Layer Topology API</description>
</project>
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Area identifier class (32 Bit Area-ID).
*/
public class AreaId {
private final int areaId;
/**
* Constructor to set area identifier.
*
* @param areaId area id
*/
public AreaId(int areaId) {
this.areaId = areaId;
}
/**
* obtain area identifier.
*
* @return area identifier
*/
public int areaId() {
return areaId;
}
@Override
public int hashCode() {
return Objects.hash(areaId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AreaId) {
AreaId other = (AreaId) obj;
return Objects.equals(areaId, other.areaId);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("areaId", areaId)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Autonomous system Number class (32 Bit ASNumber).
*/
public class AsNumber {
private final int asNum;
/**
* Constructor to set As number.
*
* @param asNum As number
*/
public AsNumber(int asNum) {
this.asNum = asNum;
}
/**
* Obtain autonomous system number.
*
* @return autonomous system number
*/
public int asNum() {
return asNum;
}
@Override
public int hashCode() {
return Objects.hash(asNum);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AsNumber) {
AsNumber other = (AsNumber) obj;
return Objects.equals(asNum, other.asNum);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("asNum", asNum)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents administrative group color.
* bit mask - least significant bit is referred to as 'group 0',
* and the most significant bit is referred to as 'group 31'
*/
public class Color {
private final int color;
/**
* Constructor to initialize its parameter.
*
* @param color assigned by the network administrator
*/
public Color(int color) {
this.color = color;
}
/**
* Obtains administrative group.
*
* @return administrative group
*/
public int color() {
return color;
}
@Override
public int hashCode() {
return Objects.hash(color);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Color) {
Color other = (Color) obj;
return Objects.equals(color, other.color);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("color", color)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
import org.onosproject.net.Element;
/**
* Default Device interface implementation.
*/
public class DefaultDeviceIntf implements DeviceIntf {
private final Element element;
private final DeviceInterface deviceInterface;
/**
* Constructor to initialize device interface parameters.
*
* @param element parent network element
* @param deviceInterface device interface
*/
public DefaultDeviceIntf(Element element, DeviceInterface deviceInterface) {
this.element = element;
this.deviceInterface = deviceInterface;
}
@Override
public Element element() {
return element;
}
@Override
public DeviceInterface deviceInterface() {
return deviceInterface;
}
@Override
public int hashCode() {
return Objects.hash(element, deviceInterface);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultDeviceIntf) {
final DefaultDeviceIntf other = (DefaultDeviceIntf) obj;
return Objects.equals(this.element.id(), other.element.id())
&& Objects.equals(this.deviceInterface, other.deviceInterface);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("element", element.id())
.add("deviceInterface", deviceInterface)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import org.onosproject.net.AbstractAnnotated;
import org.onosproject.net.Annotations;
import org.onosproject.net.Element;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Default Device prefix implementation.
*/
public class DefaultDevicePrefix extends AbstractAnnotated implements DevicePrefix {
private final Element element;
private final PrefixIdentifier prefixIdentifier;
private final PrefixTed prefixTed;
/**
* Creates a network device prefix attributed to the specified element.
*
* @param element parent network element
* @param prefixIdentifier prefix identifier
* @param prefixTed prefid traffic engineering parameters
* @param annotations optional key/value annotations
*/
public DefaultDevicePrefix(Element element, PrefixIdentifier prefixIdentifier,
PrefixTed prefixTed, Annotations... annotations) {
super(annotations);
this.element = element;
this.prefixIdentifier = prefixIdentifier;
this.prefixTed = prefixTed;
}
@Override
public Element element() {
return element;
}
@Override
public PrefixIdentifier prefixIdentifier() {
return prefixIdentifier;
}
@Override
public PrefixTed prefixTed() {
return prefixTed;
}
@Override
public int hashCode() {
return Objects.hash(element, prefixIdentifier, prefixTed);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultDevicePrefix) {
final DefaultDevicePrefix other = (DefaultDevicePrefix) obj;
return Objects.equals(this.element.id(), other.element.id()) &&
Objects.equals(this.prefixIdentifier, other.prefixIdentifier) &&
Objects.equals(this.prefixTed, other.prefixTed) &&
Objects.equals(this.annotations(), other.annotations());
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("element", element.id())
.add("prefixIdentifier", prefixIdentifier)
.add("prefixTed", prefixTed)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import org.onosproject.net.AbstractElement;
import org.onosproject.net.Annotations;
import org.onosproject.net.DeviceId;
import org.onosproject.net.provider.ProviderId;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Default ip device model implementation.
*/
public class DefaultIpDevice extends AbstractElement implements IpDevice {
private final Type type;
private final IpDeviceIdentifier deviceIdentifier;
private final DeviceTed deviceTed;
/**
* For Serialization.
*/
private DefaultIpDevice() {
this.type = null;
this.deviceIdentifier = null;
this.deviceTed = null;
}
/**
* Creates a network element attributed to the specified provider.
*
* @param providerId identity of the provider
* @param id device identifier
* @param type device type
* @param deviceIdentifier provides device identifier details
* @param deviceTed device traffic engineering parameters
* @param annotations optional key/value annotations
*/
public DefaultIpDevice(ProviderId providerId, DeviceId id, Type type,
IpDeviceIdentifier deviceIdentifier, DeviceTed deviceTed,
Annotations... annotations) {
super(providerId, id, annotations);
this.type = type;
this.deviceIdentifier = deviceIdentifier;
this.deviceTed = deviceTed;
}
@Override
public DeviceId id() {
return (DeviceId) id;
}
@Override
public Type type() {
return type;
}
@Override
public IpDeviceIdentifier deviceIdentifier() {
return deviceIdentifier;
}
@Override
public DeviceTed deviceTed() {
return deviceTed; }
@Override
public int hashCode() {
return Objects.hash(type, deviceIdentifier, deviceTed);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultIpDevice) {
final DefaultIpDevice other = (DefaultIpDevice) obj;
return Objects.equals(this.id, other.id) &&
Objects.equals(this.type, other.type) &&
Objects.equals(this.deviceIdentifier, other.deviceIdentifier) &&
Objects.equals(this.deviceTed, other.deviceTed);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("id", id)
.add("deviceIdentifier", deviceIdentifier)
.add("deviceTed", deviceTed)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import org.onosproject.net.AbstractModel;
import org.onosproject.net.Annotations;
import org.onosproject.net.provider.ProviderId;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* This class provides Link identifier and link ted details.
*/
public class DefaultIpLink extends AbstractModel implements IpLink {
private final TerminationPoint src;
private final TerminationPoint dst;
private final IpLinkIdentifier linkIdentifier;
private final LinkTed linkTed;
/**
* Constructor to initialize its parameters.
*
* @param src link source termination point
* @param dst link destination termination point
* @param linkIdentifier provides link identifier details
* @param linkTed provides link traffic engineering details
* @param annotations optional key/value annotations
*/
public DefaultIpLink(ProviderId providerId, TerminationPoint src, TerminationPoint dst,
IpLinkIdentifier linkIdentifier, LinkTed linkTed,
Annotations... annotations) {
super(providerId, annotations);
this.src = src;
this.dst = dst;
this.linkIdentifier = linkIdentifier;
this.linkTed = linkTed;
}
@Override
public TerminationPoint src() {
return src;
}
@Override
public TerminationPoint dst() {
return dst;
}
@Override
public IpLinkIdentifier linkIdentifier() {
return linkIdentifier;
}
@Override
public LinkTed linkTed() {
return linkTed;
}
@Override
public int hashCode() {
return Objects.hash(src, dst, linkIdentifier, linkTed);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DefaultIpLink) {
final DefaultIpLink other = (DefaultIpLink) obj;
return Objects.equals(this.src, other.src) &&
Objects.equals(this.dst, other.dst) &&
Objects.equals(this.linkIdentifier, other.linkIdentifier) &&
Objects.equals(this.linkTed, other.linkTed);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("src", src)
.add("dst", dst)
.add("linkIdentifier", linkIdentifier)
.add("linkTed", linkTed)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import java.util.Objects;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import com.google.common.base.MoreObjects;
/**
* Representation of device interface.
*/
public class DeviceInterface {
private final Ip4Address ip4Address;
private final Ip6Address ip6Address;
private final InterfaceIdentifier interfaceId;
/**
* Constructor to initialize its parameter.
*
* @param ip4Address ipv4 interface address
* @param ip6Address ipv6 interface address
* @param interfaceId interface Identifier
*/
public DeviceInterface(Ip4Address ip4Address, Ip6Address ip6Address, InterfaceIdentifier interfaceId) {
this.ip4Address = ip4Address;
this.ip6Address = ip6Address;
this.interfaceId = interfaceId;
}
/**
* obtains ipv4 address of an interface.
*
* @return ipv4 interface address
*/
public Ip4Address ip4Address() {
return ip4Address;
}
/**
* obtains ipv6 interface address.
*
* @return ipv6 interface address
*/
public Ip6Address ip6Address() {
return ip6Address;
}
/**
* obtains interface identifier.
*
* @return interface identifier
*/
public InterfaceIdentifier interfaceId() {
return interfaceId;
}
@Override
public int hashCode() {
return Objects.hash(ip4Address, ip6Address, interfaceId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DeviceInterface) {
final DeviceInterface other = (DeviceInterface) obj;
return Objects.equals(this.ip4Address, other.ip4Address)
&& Objects.equals(this.ip6Address, other.ip6Address)
&& Objects.equals(this.interfaceId, other.interfaceId);
}
return false;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("ip4Address", ip4Address)
.add("ip6Address", ip6Address)
.add("interfaceId", interfaceId)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import org.onosproject.net.Element;
/**
* Abstraction of Device interface.
*/
public interface DeviceIntf {
/**
* Returns the parent network element to which this interface belongs.
*
* @return parent network element
*/
Element element();
/**
* Returns device interface details.
*
* @return device interface details
*/
DeviceInterface deviceInterface();
}
\ No newline at end of file
/*
* 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.iptopology.api;
import org.onosproject.net.Annotated;
import org.onosproject.net.Element;
/**
* Abstraction of Device Prefix.
*/
public interface DevicePrefix extends Annotated {
/**
* Returns the parent network element to which this port belongs.
*
* @return parent network element
*/
Element element();
/**
* Returns prefix identifier details.
*
* @return prefix identifier details
*/
PrefixIdentifier prefixIdentifier();
/**
* Returns prefix Traffic engineering parameters.
*
* @return prefix Traffic engineering parameters
*/
PrefixTed prefixTed();
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
/**
* Represents Device Traffic Engineering parameters.
*/
public class DeviceTed {
private final List<Ip4Address> ipv4RouterIds;
private final List<Ip6Address> ipv6RouterIds;
private final List<TopologyId> topologyIds;
private final Position position;
/**
* Constructor to initialize the parameter fields.
*
* @param ipv4RouterIds Router ids of Ipv4
* @param ipv6RouterIds Router ids of Ipv6
* @param topologyIds list of multi-topology IDs of the node
* @param position of router whether it is ABR or ASBR
*/
public DeviceTed(List<Ip4Address> ipv4RouterIds, List<Ip6Address> ipv6RouterIds,
List<TopologyId> topologyIds, Position position) {
this.ipv4RouterIds = ipv4RouterIds;
this.ipv6RouterIds = ipv6RouterIds;
this.topologyIds = topologyIds;
this.position = position;
}
/**
* Obtain list of Ipv4 Router id.
*
* @return Ipv4 Router ids
*/
public List<Ip4Address> ipv4RouterIds() {
return ipv4RouterIds;
}
/**
* Obtain list of Ipv6 Router id.
*
* @return Ipv6 Router ids
*/
public List<Ip6Address> ipv6RouterIds() {
return ipv6RouterIds;
}
/**
* Obtain the list of topology ID's.
*
* @return list of topology id's
*/
public List<TopologyId> topologyIds() {
return topologyIds;
}
/**
* Obtain position of device in the network.
*
* @return position of device in the network
*/
public Position position() {
return position;
}
@Override
public int hashCode() {
return Objects.hash(ipv4RouterIds, ipv6RouterIds, topologyIds, position);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DeviceTed) {
int countObjSubTlv = 0;
int countOtherSubTlv = 0;
int countObjTopologyId = 0;
int countOtherTopologyId = 0;
boolean isCommonSubTlv = true;
boolean isCommonSubTlv6 = true;
boolean isCommonTopology = true;
DeviceTed other = (DeviceTed) obj;
Iterator<Ip4Address> objListIterator = other.ipv4RouterIds.iterator();
countOtherSubTlv = other.ipv4RouterIds.size();
countObjSubTlv = ipv4RouterIds.size();
Iterator<Ip6Address> objListIteratorIpv6 = other.ipv6RouterIds.iterator();
int countOtherSubTlv6 = other.ipv6RouterIds.size();
int countObjSubTlv6 = ipv6RouterIds.size();
Iterator<TopologyId> topologyId = other.topologyIds.iterator();
countOtherTopologyId = other.topologyIds.size();
countObjTopologyId = topologyIds.size();
if (countObjSubTlv != countOtherSubTlv || countOtherSubTlv6 != countObjSubTlv6
|| countObjTopologyId != countOtherTopologyId) {
return false;
} else {
while (objListIterator.hasNext() && isCommonSubTlv) {
Ip4Address subTlv = objListIterator.next();
//find index of that element and then get that from the list and then compare
if (ipv4RouterIds.contains(subTlv) && other.ipv4RouterIds.contains(subTlv)) {
isCommonSubTlv = Objects.equals(ipv4RouterIds.get(ipv4RouterIds.indexOf(subTlv)),
other.ipv4RouterIds.get(other.ipv4RouterIds.indexOf(subTlv)));
} else {
isCommonSubTlv = false;
}
}
while (objListIteratorIpv6.hasNext() && isCommonSubTlv6) {
Ip6Address subTlv = objListIteratorIpv6.next();
//find index of that element and then get that from the list and then compare
if (ipv6RouterIds.contains(subTlv) && other.ipv6RouterIds.contains(subTlv)) {
isCommonSubTlv6 = Objects.equals(ipv6RouterIds.get(ipv6RouterIds.indexOf(subTlv)),
other.ipv6RouterIds.get(other.ipv6RouterIds.indexOf(subTlv)));
} else {
isCommonSubTlv6 = false;
}
}
while (topologyId.hasNext() && isCommonTopology) {
TopologyId subTlv = topologyId.next();
//find index of that element and then get that from the list and then compare
if (topologyIds.contains(subTlv) && other.topologyIds.contains(subTlv)) {
isCommonTopology = Objects.equals(topologyIds.get(topologyIds.indexOf(subTlv)),
other.topologyIds.get(other.topologyIds.indexOf(subTlv)));
} else {
isCommonTopology = false;
}
}
return isCommonSubTlv && isCommonSubTlv6 && isCommonTopology
&& Objects.equals(position, other.position);
}
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("ipv6RouterIds", ipv6RouterIds)
.add("ipv4RouterIds", ipv4RouterIds)
.add("topologyIds", topologyIds)
.add("position", position)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Domain Identifier(32 Bit).
*/
public class DomainId {
private final int domainIdentifier;
/**
* Constructor to initialize domain identifier.
*
* @param domainIdentifier domain identifier
*/
public DomainId(int domainIdentifier) {
this.domainIdentifier = domainIdentifier;
}
/**
* Obtain domain identifier.
*
* @return domain identifier
*/
public int domainIdentifier() {
return domainIdentifier;
}
@Override
public int hashCode() {
return Objects.hash(domainIdentifier);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof DomainId) {
DomainId other = (DomainId) obj;
return Objects.equals(domainIdentifier, other.domainIdentifier);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("domainIdentifier", domainIdentifier)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents the extended igp administrative tags of the prefix.
*/
public class ExtendedRouteTag {
private final long extRouteTag;
/**
* Constructor to initialize its parameter.
*
* @param extRouteTag extended ISIS route tag
*/
public ExtendedRouteTag(long extRouteTag) {
this.extRouteTag = extRouteTag;
}
/**
* Obtains extended igp administrative tags.
*
* @return extended igp administrative tags
*/
public long extRouteTag() {
return extRouteTag;
}
@Override
public int hashCode() {
return Objects.hash(extRouteTag);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof ExtendedRouteTag) {
ExtendedRouteTag other = (ExtendedRouteTag) obj;
return Objects.equals(extRouteTag, other.extRouteTag);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("extRouteTag", extRouteTag)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* This class provides implementation IS-IS and OSPF flags assigned to the prefix.
*/
public class IgpFlags {
private final boolean isisUpDown;
private final boolean ospfNoUnicast;
private final boolean ospfLclAddr;
private final boolean ospfNssa;
/**
* Constructor to initialize its parameters.
*
* @param isisUpDown IS-IS Up/Down
* @param ospfNoUnicast OSPF no unicast
* @param ospfLclAddr OSPF local address
* @param ospfNssa OSPF propagate NSSA
*/
public IgpFlags(boolean isisUpDown, boolean ospfNoUnicast, boolean ospfLclAddr,
boolean ospfNssa) {
this.isisUpDown = isisUpDown;
this.ospfNoUnicast = ospfNoUnicast;
this.ospfLclAddr = ospfLclAddr;
this.ospfNssa = ospfNssa;
}
/**
* Provides information whether IS-IS is Up/Down.
*
* @return IS-IS Up/Down bit enabled or not
*/
public boolean isisUpDown() {
return isisUpDown;
}
/**
* Provides information whether OSPF is unicast or not.
*
* @return OSPF no unicast Bit set or not
*/
public boolean ospfNoUnicast() {
return ospfNoUnicast;
}
/**
* Provides information on OSPF local address.
*
* @return OSPF local address Bit set or not
*/
public boolean ospfLclAddr() {
return ospfLclAddr;
}
/**
* Provides information on OSPF propagate NSSA.
*
* @return OSPF propagate NSSA Bit set or not
*/
public boolean ospfNssa() {
return ospfNssa;
}
@Override
public int hashCode() {
return Objects.hash(isisUpDown, ospfNoUnicast, ospfLclAddr,
ospfNssa);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IgpFlags) {
IgpFlags other = (IgpFlags) obj;
return Objects.equals(isisUpDown, other.isisUpDown)
&& Objects.equals(ospfNoUnicast, other.ospfNoUnicast)
&& Objects.equals(ospfLclAddr, other.ospfLclAddr)
&& Objects.equals(ospfNssa, other.ospfNssa);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("isisUpDown", isisUpDown)
.add("ospfNoUnicast", ospfNoUnicast)
.add("ospfLclAddr", ospfLclAddr)
.add("ospfNssa", ospfNssa)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* This class provides information on Local Interface Identifier and Remote
* Interface Identifier of the link.
*/
public class InterfaceIdentifier {
private final Integer identifier;
/**
* Constructor to initialize identifier.
*
* @param identifier local/remote interface identifier
*/
public InterfaceIdentifier(Integer identifier) {
this.identifier = identifier;
}
/**
* Provides the local/remote interface identifier of the link.
*
* @return interface identifier
*/
public Integer identifier() {
return identifier;
}
@Override
public int hashCode() {
return Objects.hash(identifier);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof InterfaceIdentifier) {
InterfaceIdentifier other = (InterfaceIdentifier) obj;
return Objects.equals(identifier, other.identifier);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("identifier", identifier)
.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.iptopology.api;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Element;
/**
* Abstraction of Ip Device.
*/
public interface IpDevice extends Element {
/**
** Enum type to store Device Type.
*/
enum Type {
/**
* Signifies that the device is pseudo device.
*/
PSEUDO,
/**
* Signifies that the device is non-pseudo device.
*/
NONPSEUDO;
}
/**
* Obtains device id.
*
* @return device id
*/
@Override
DeviceId id();
/**
* Obtains device type.
*
* @return device type
*/
Type type();
/**
* Obtains Device identifier details.
*
* @return identifier of the device
*/
IpDeviceIdentifier deviceIdentifier();
/**
* Obtains the traffic engineering parameters of the device.
*
* @return traffic engineering parameters of the device
*/
DeviceTed deviceTed();
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents IP Device Identifiers.
*/
public class IpDeviceIdentifier {
private final RouteDistinguisher routeDish;
private final RouteInstance routeInstance;
private final AsNumber asNum;
private final DomainId domainIdentifier;
private final AreaId areaId;
private final RouteIdentifier routerIdentifier;
/**
* Constructor to initialize parameters.
*
* @param routeInstance routing protocol instance
* @param asNum AS number
* @param domainIdentifier BGP-LS domain
* @param areaId Area ID
* @param routerIdentifier IGP router ID
*/
public IpDeviceIdentifier(RouteDistinguisher routeDish, RouteInstance routeInstance, AsNumber asNum,
DomainId domainIdentifier, AreaId areaId, RouteIdentifier routerIdentifier) {
this.routeDish = routeDish;
this.areaId = areaId;
this.asNum = asNum;
this.domainIdentifier = domainIdentifier;
this.routeInstance = routeInstance;
this.routerIdentifier = routerIdentifier;
}
/**
* Obtains Route Distinguisher of Ip Device.
*
* @return Area ID
*/
public RouteDistinguisher routeDish() {
return routeDish;
}
/**
* Obtains Area ID if Ip Device.
*
* @return Area ID
*/
public AreaId areaId() {
return areaId;
}
/**
* Obtains AS number of Ip Device.
*
* @return AS number
*/
public AsNumber asNum() {
return asNum;
}
/**
* Obtains domain identifier of Ip Device.
*
* @return domain identifier
*/
public DomainId domainIdentifier() {
return domainIdentifier;
}
/**
* Obtains Router id of Ip Device.
*
* @return Router id
*/
public RouteIdentifier routerIdentifier() {
return routerIdentifier;
}
/**
* Obtains routing protocol instance.
*
* @return routing protocol instance
*/
public RouteInstance routeInstance() {
return routeInstance;
}
@Override
public int hashCode() {
return Objects.hash(routeDish, areaId, asNum, domainIdentifier, routerIdentifier, routeInstance);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IpDeviceIdentifier) {
IpDeviceIdentifier other = (IpDeviceIdentifier) obj;
return Objects.equals(areaId, other.areaId) && Objects.equals(asNum, other.asNum)
&& Objects.equals(domainIdentifier, other.domainIdentifier)
&& Objects.equals(routerIdentifier, other.routerIdentifier)
&& Objects.equals(routeInstance, other.routeInstance)
&& Objects.equals(routeDish, other.routeDish);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("areaId", areaId)
.add("asNum", asNum)
.add("domainIdentifier", domainIdentifier)
.add("routerIdentifier", routerIdentifier)
.add("routeInstance", routeInstance)
.add("routeDish", routeDish)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import org.onosproject.net.Annotated;
import org.onosproject.net.NetworkResource;
import org.onosproject.net.Provided;
/**
* Abstraction of a network ip link.
*/
public interface IpLink extends Annotated, Provided, NetworkResource {
/**
* Returns source termination point of link.
*
* @return source termination point of link
*/
TerminationPoint src();
/**
* Returns destination termination point of link.
*
* @return destination termination point of link
*/
TerminationPoint dst();
/**
* Returns link identifier details.
*
* @return link identifier details
*/
IpLinkIdentifier linkIdentifier();
/**
* Returns the link traffic engineering parameters.
*
* @return links traffic engineering parameters
*/
LinkTed linkTed();
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
/**
* Represents Ip Link Identifier.
*/
public class IpLinkIdentifier {
private final InterfaceIdentifier localIndentifier;
private final InterfaceIdentifier remoteIndentifier;
private final Ip4Address localIpv4Addr;
private final Ip4Address remoteIpv4Addr;
private final Ip6Address localIpv6Addr;
private final Ip6Address remoteIpv6Addr;
private final TopologyId topologyId;
/**
* Constructor to initialize its parameters.
*
* @param localIndentifier local interface identifier of the link
* @param remoteIndentifier remote interface identifier of the link
* @param localIpv4Addr local IPv4 address of the link
* @param remoteIpv4Addr remote IPv4 address of the link
* @param localIpv6Addr local IPv6 address of the link
* @param remoteIpv6Addr remote IPv6 address of the link
* @param topologyId link topology identifier
*/
public IpLinkIdentifier(InterfaceIdentifier localIndentifier, InterfaceIdentifier remoteIndentifier,
Ip4Address localIpv4Addr, Ip4Address remoteIpv4Addr, Ip6Address localIpv6Addr,
Ip6Address remoteIpv6Addr, TopologyId topologyId) {
this.localIndentifier = localIndentifier;
this.remoteIndentifier = remoteIndentifier;
this.localIpv4Addr = localIpv4Addr;
this.remoteIpv4Addr = remoteIpv4Addr;
this.localIpv6Addr = localIpv6Addr;
this.remoteIpv6Addr = remoteIpv6Addr;
this.topologyId = topologyId;
}
/**
* Obtains link local identifier.
*
* @return link local identifier
*/
public InterfaceIdentifier localIndentifier() {
return localIndentifier;
}
/**
* Obtains link local identifier.
*
* @return link local identifier
*/
public InterfaceIdentifier remoteIndentifier() {
return remoteIndentifier;
}
/**
* Obtains local IPv4 address of the link.
*
* @return local IPv4 address of the link
*/
public Ip4Address localIpv4Addr() {
return localIpv4Addr;
}
/**
* Obtains remote IPv4 address of the link.
*
* @return remote IPv4 address of the link
*/
public Ip4Address remoteIpv4Addr() {
return remoteIpv4Addr;
}
/**
* Obtains local IPv6 address of the link.
*
* @return local IPv6 address of the link
*/
public Ip6Address localIpv6Addr() {
return localIpv6Addr;
}
/**
* Obtains remote IPv6 address of the link.
*
* @return remote IPv6 address of the link
*/
public Ip6Address remoteIpv6Addr() {
return remoteIpv6Addr;
}
/**
* Obtains Topology ID of the link.
*
* @return Topology ID of the link
*/
public TopologyId topologyId() {
return topologyId;
}
@Override
public int hashCode() {
return Objects.hash(localIndentifier, remoteIndentifier, localIpv4Addr, remoteIpv4Addr,
localIpv6Addr, remoteIpv6Addr, topologyId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IpLinkIdentifier) {
IpLinkIdentifier other = (IpLinkIdentifier) obj;
return Objects.equals(topologyId, other.topologyId)
&& Objects.equals(localIndentifier, other.localIndentifier)
&& Objects.equals(remoteIndentifier, other.remoteIndentifier)
&& Objects.equals(localIpv4Addr, other.localIpv4Addr)
&& Objects.equals(remoteIpv4Addr, other.remoteIpv4Addr)
&& Objects.equals(localIpv6Addr, other.localIpv6Addr)
&& Objects.equals(remoteIpv6Addr, other.remoteIpv6Addr);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("localIndentifier", localIndentifier)
.add("remoteIndentifier", remoteIndentifier)
.add("localIpv4Addr", localIpv4Addr)
.add("remoteIpv4Addr", remoteIpv4Addr)
.add("localIpv6Addr", localIpv6Addr)
.add("remoteIpv6Addr", remoteIpv6Addr)
.add("topologyId", topologyId)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
import org.onlab.packet.IpPrefix;
/**
* Provides information of IP address prefix in the IGP topology and a router advertises
* this to each of its BGP nexthop.
*/
public class IpReachability {
private final IpPrefix ipPrefix;
/**
* Constructor to initialize IP prefix.
*
* @param ipPrefix IP address prefix
*/
public IpReachability(IpPrefix ipPrefix) {
this.ipPrefix = ipPrefix;
}
/**
* Provides IP Address prefix reachability.
*
* @return IP Address prefix
*/
public IpPrefix ipPrefix() {
return ipPrefix;
}
@Override
public int hashCode() {
return Objects.hash(ipPrefix);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IpReachability) {
IpReachability other = (IpReachability) obj;
return Objects.equals(ipPrefix, other.ipPrefix);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("ipPrefix", ipPrefix)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents the Pseudonode information of device in ISIS domain.
*/
public class IsIsPseudonode implements RouteIdentifier {
private final IsoNodeId isoNodeId;
private final byte psnIdentifier;
private final ProtocolType type;
/**
* Constructor to initialize the values.
*
* @param isoNodeId ISO system-ID
* @param psnIdentifier Pseudonode identifier
* @param type Protocol ID
*/
public IsIsPseudonode(IsoNodeId isoNodeId, byte psnIdentifier, ProtocolType type) {
this.isoNodeId = isoNodeId;
this.psnIdentifier = psnIdentifier;
this.type = type;
}
/**
* Obtains iso system id of Pseudonode of device in ISIS domain.
*
* @return ISO system Id
*/
public IsoNodeId isoNodeId() {
return isoNodeId;
}
/**
* Obtains Pseudonode identifier.
*
* @return Pseudonode identifier
*/
public byte psnIdentifier() {
return psnIdentifier;
}
@Override
public ProtocolType type() {
return type;
}
@Override
public int hashCode() {
return Objects.hash(isoNodeId, psnIdentifier, type);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IsIsPseudonode) {
IsIsPseudonode other = (IsIsPseudonode) obj;
return Objects.equals(isoNodeId, other.isoNodeId) && Objects.equals(psnIdentifier, other.psnIdentifier)
&& Objects.equals(type, other.type);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("isoNodeId", isoNodeId)
.add("psnIdentifier", psnIdentifier)
.add("type", type)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents ISO system id of the device.
*/
public class IsoNodeId implements RouteIdentifier {
private final byte[] isoNodeId;
private final ProtocolType type;
/**
* Constructor to initialize the values.
*
* @param isoNodeId ISO system-ID
* @param type Protocol type
*/
public IsoNodeId(byte[] isoNodeId, ProtocolType type) {
this.isoNodeId = isoNodeId;
this.type = type;
}
/**
* Obtains ISO system id of the device.
*
* @return ISO system id
*/
public byte[] isoNodeId() {
return isoNodeId;
}
@Override
public ProtocolType type() {
return type;
}
@Override
public int hashCode() {
return Objects.hash(isoNodeId, type);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof IsoNodeId) {
IsoNodeId other = (IsoNodeId) obj;
return Objects.equals(isoNodeId, other.isoNodeId) && Objects.equals(type, other.type);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("isoNodeId", isoNodeId)
.add("type", type)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents Traffic engineering metrics.
*/
public class Metric {
private final Integer metric;
/**
* Constructor to initialize its metric.
*
* @param metric can be TE metric or IGP metric or Prefix metric
*/
public Metric(Integer metric) {
this.metric = metric;
}
/**
* Obtains traffic engineering metric.
*
* @return traffic engineering metric
*/
public Integer metric() {
return metric;
}
@Override
public int hashCode() {
return Objects.hash(metric);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Metric) {
Metric other = (Metric) obj;
return Objects.equals(metric, other.metric);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("metric", metric)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
import org.onlab.packet.Ip4Address;
/**
* Represents Pseudonode information of OSFP device.
*/
public class OspfPseudonode implements RouteIdentifier {
private final RouterId designatedRouter;
private final Ip4Address drInterface;
private final ProtocolType type;
/**
* Constructor to initialize the values.
*
* @param designatedRouter Router Id of designated router
* @param drInterface IP address of Designated Router interface
* @param type Protocol ID
*/
public OspfPseudonode(RouterId designatedRouter, Ip4Address drInterface, ProtocolType type) {
this.designatedRouter = designatedRouter;
this.drInterface = drInterface;
this.type = type;
}
/**
* Obtains designated Router Id.
*
* @return designated Router Id
*/
public RouterId designatedRouter() {
return designatedRouter;
}
/**
* Obtains IP address of Designated Router interface.
*
* @return IP address of Designated Router interface
*/
public Ip4Address drInterface() {
return drInterface;
}
@Override
public ProtocolType type() {
return type;
}
@Override
public int hashCode() {
return Objects.hash(designatedRouter, drInterface, type);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OspfPseudonode) {
OspfPseudonode other = (OspfPseudonode) obj;
return Objects.equals(designatedRouter, other.designatedRouter)
&& Objects.equals(drInterface, other.drInterface)
&& Objects.equals(type, other.type);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("designatedRouter", designatedRouter)
.add("drInterface", drInterface)
.add("type", type)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents Position of device in the network.
*/
public class Position {
private final Boolean asbr;
private final Boolean abr;
/**
* Constructor to set position of device.
*
* @param asbr autonomous system boundary router
* @param abr area boundary router
*/
public Position(Boolean asbr, Boolean abr) {
this.asbr = asbr;
this.abr = abr;
}
/**
* obtain whether the device is autonomous system boundary router or not.
*
* @return autonomous system boundary router or not
*/
Boolean asbr() {
return asbr;
}
/**
* obtain whether the device is area boundary router or not.
*
* @return area boundary router or not
*/
Boolean abr() {
return abr;
}
@Override
public int hashCode() {
return Objects.hash(abr, asbr);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Position) {
Position other = (Position) obj;
return Objects.equals(abr, other.abr) && Objects.equals(asbr, other.asbr);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("abrBit", abr)
.add("asbrBit", asbr)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* This class provides Prefix Identifier details.
*/
public class PrefixIdentifier {
private final TopologyId topologyId;
private final RouteType routeType;
private final IpReachability ipReach;
/**
* Constructor to initialize its parameters.
*
* @param topologyId topology ID of prefix
* @param routeType OSPF Route type of the prefix
* @param ipReach IP address prefix reachability information
*/
public PrefixIdentifier(TopologyId topologyId, RouteType routeType, IpReachability ipReach) {
this.topologyId = topologyId;
this.routeType = routeType;
this.ipReach = ipReach;
}
/**
* Provides topology ID of prefix.
*
* @return topology id
*/
public TopologyId topologyId() {
return this.topologyId;
}
/**
* Provides IP address prefix reachability information.
*
* @return IP address prefix
*/
public IpReachability ipReach() {
return this.ipReach;
}
/**
* Provides OSPF Route type of the prefix.
*
* @return Route type
*/
public RouteType routeType() {
return this.routeType;
}
@Override
public int hashCode() {
return Objects.hash(topologyId, routeType, ipReach);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof PrefixIdentifier) {
PrefixIdentifier other = (PrefixIdentifier) obj;
return Objects.equals(topologyId, other.topologyId) && Objects.equals(routeType, other.routeType)
&& Objects.equals(ipReach, other.ipReach);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("routeType", routeType)
.add("ipReach", ipReach)
.add("topologyId", topologyId)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
import org.onlab.packet.IpAddress;
/**
* This class provides implementation of prefix traffic engineering data.
*/
public class PrefixTed {
private final IgpFlags igpFlags;
private final RouteTag routeTag;
private final ExtendedRouteTag extendedRouteTag;
private final Metric metric;
private final IpAddress fwdingAddress;
/**
* Constructor to initialize its parameters.
*
* @param igpFlags igp flags
* @param routeTag ospf route tag
* @param extendedRouteTag isis route tag
* @param metric prefix metric
* @param fwdingAddress forwarding address
*/
/**
* Constructor to initialize its parameters.
*
* @param igpFlags IS-IS and OSPF flags assigned to the prefix
* @param routeTag IGP (ISIS or OSPF) tags of the prefix
* @param extendedRouteTag extended ISIS route tags of the prefix
* @param metric metric of the prefix
* @param fwdingAddress OSPF forwarding address
*/
public PrefixTed(IgpFlags igpFlags, RouteTag routeTag, ExtendedRouteTag extendedRouteTag,
Metric metric, IpAddress fwdingAddress) {
this.igpFlags = igpFlags;
this.routeTag = routeTag;
this.extendedRouteTag = extendedRouteTag;
this.metric = metric;
this.fwdingAddress = fwdingAddress;
}
/**
* Provides IS-IS and OSPF flags assigned to the prefix.
*
* @return IGP flags
*/
public IgpFlags igpFlags() {
return igpFlags;
}
/**
* Provides IGP (ISIS or OSPF) tags of the prefix.
*
* @return IGP route tag.
*/
public RouteTag routeTag() {
return routeTag;
}
/**
* Provides extended ISIS route tags of the prefix.
*
* @return extended IS-IS route tag
*/
public ExtendedRouteTag extendedRouteTag() {
return extendedRouteTag;
}
/**
* Provides metric of the prefix.
*
* @return prefix metric
*/
public Metric metric() {
return metric;
}
/**
* Provides OSPF forwarding address.
*
* @return forwarding address
*/
public IpAddress fwdingAddress() {
return fwdingAddress;
}
@Override
public int hashCode() {
return Objects.hash(igpFlags, routeTag, extendedRouteTag, metric, fwdingAddress);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof PrefixTed) {
PrefixTed other = (PrefixTed) obj;
return Objects.equals(igpFlags, other.igpFlags) && Objects.equals(extendedRouteTag, other.extendedRouteTag)
&& Objects.equals(routeTag, other.routeTag) && Objects.equals(metric, other.metric)
&& Objects.equals(fwdingAddress, other.fwdingAddress);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.omitNullValues()
.add("igpFlags", igpFlags)
.add("extendedRouteTag", extendedRouteTag)
.add("routeTag", routeTag)
.add("metric", metric)
.add("fwdingAddress", fwdingAddress)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents protection capabilities of the link.
*/
public class ProtectionType {
private final LinkProtectionType protectionType;
/**
* Enum to provide Link Protection type.
*/
public enum LinkProtectionType {
Extra_Traffic(1), Unprotected(2), Shared(4), Enhanced(0x20), Dedicated_OneIsToOne(8),
Dedicated_OnePlusOne(0x10), Reserved(0x40);
int value;
/**
* Constructor to assign value.
*
* @param val link protection type
*/
LinkProtectionType(int val) {
value = val;
}
/**
* Provides Link protection type.
*
* @return protection type
*/
public byte type() {
return (byte) value;
}
}
/**
* Constructor to initialize protection type.
*
* @param protectionType link protection type
*/
public ProtectionType(LinkProtectionType protectionType) {
this.protectionType = protectionType;
}
/**
* Provides protection capabilities of the link.
*
* @return link protection type.
*/
public LinkProtectionType protectionType() {
return protectionType;
}
@Override
public int hashCode() {
return Objects.hash(protectionType);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof ProtectionType) {
ProtectionType other = (ProtectionType) obj;
return Objects.equals(protectionType, other.protectionType);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("protectionType", protectionType)
.toString();
}
}
\ No newline at end of file
/*
* 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.
*/
/**
* Implementation of RouteDistinguisher.
*/
package org.onosproject.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents Route Distinguisher of device in the network.
*/
public class RouteDistinguisher {
private final Long routeDistinguisher;
/**
* Constructor to initialize parameters.
*
* @param routeDistinguisher route distinguisher
*/
public RouteDistinguisher(Long routeDistinguisher) {
this.routeDistinguisher = routeDistinguisher;
}
/**
* Obtain route distinguisher.
*
* @return route distinguisher
*/
public Long routeDistinguisher() {
return routeDistinguisher;
}
@Override
public int hashCode() {
return Objects.hash(routeDistinguisher);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof RouteDistinguisher) {
RouteDistinguisher other = (RouteDistinguisher) obj;
return Objects.equals(routeDistinguisher, other.routeDistinguisher);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("routeDistinguisher", routeDistinguisher)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
/**
* Abstraction of Router ID to identify the router with a distinct IP address.
*/
public interface RouteIdentifier {
/**
* Enum to provide Protocol type.
*/
public enum ProtocolType {
ISIS_LevelOne(1), ISIS_LevelTwo(2), OSPFv2(3), Direct(4), Static_Configuration(5), OSPFv3(6);
int value;
/**
* Sets protocol ID.
*
* @param val protocol ID
*/
ProtocolType(int val) {
value = val;
}
/**
* Provides Protocol ID.
*
* @return Protocol ID
*/
public byte getType() {
return (byte) value;
}
}
/**
* Provides Protocol ID to identify which protocol routing instance is used.
*
* @return Protocol type
*/
ProtocolType type();
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents routing universe where the network element belongs.
*/
public class RouteInstance {
private final long routeInstance;
/**
* Constructor to initialize routeInstance.
*
* @param routeInstance routing protocol instance
*/
public RouteInstance(long routeInstance) {
this.routeInstance = routeInstance;
}
/**
* Obtain route instance.
*
* @return route instance
*/
public long routeInstance() {
return routeInstance;
}
@Override
public int hashCode() {
return Objects.hash(routeInstance);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof RouteInstance) {
RouteInstance other = (RouteInstance) obj;
return Objects.equals(routeInstance, other.routeInstance);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("routeInstance", routeInstance)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents the igp administrative tags of the prefix.
*/
public class RouteTag {
private final int routeTag;
/**
* Constructor to initialize its parameter.
*
* @param routeTag IGP route tag
*/
public RouteTag(int routeTag) {
this.routeTag = routeTag;
}
/**
* Obtains igp administrative tags of the prefix.
*
* @return igp administrative tags of the prefix
*/
public int routeTag() {
return routeTag;
}
@Override
public int hashCode() {
return Objects.hash(routeTag);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof RouteTag) {
RouteTag other = (RouteTag) obj;
return Objects.equals(routeTag, other.routeTag);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("routeTag", routeTag)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents Route type of the prefix in the OSPF domain.
*/
public class RouteType {
private final Type routeType;
/**
* Enum to provide Route type.
*/
public enum Type {
Intra_Area(1), Inter_Area(2), External_1(3), External_2(4), NSSA_1(5), NSSA_2(6);
int value;
/**
* Constructor to assign value.
*
* @param val route type
*/
Type(int val) {
value = val;
}
/**
* Provides route type.
*
* @return route type
*/
public byte type() {
return (byte) value;
}
}
/**
* Constructor to initialize routeType.
*
* @param routeType Route type
*/
public RouteType(Type routeType) {
this.routeType = routeType;
}
/**
* Provides Route type of the prefix.
*
* @return Route type
*/
public Type routeType() {
return routeType;
}
@Override
public int hashCode() {
return Objects.hash(routeType);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof RouteType) {
RouteType other = (RouteType) obj;
return Objects.equals(routeType, other.routeType);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("routeType", routeType)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents Router ID of the device.
*/
public class RouterId implements RouteIdentifier {
private final int routerId;
private final ProtocolType type;
/**
* Constructor to initialize its parameters.
*
* @param routerId Router ID of designated router
*/
public RouterId(int routerId, ProtocolType type) {
this.routerId = routerId;
this.type = type;
}
/**
* Obtains Router Id of the device.
*
* @return Router Id of the device
*/
public int routerId() {
return routerId;
}
@Override
public ProtocolType type() {
return type;
}
@Override
public int hashCode() {
return Objects.hash(routerId, type);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof RouterId) {
RouterId other = (RouterId) obj;
return Objects.equals(routerId, other.routerId) && Objects.equals(type, other.type);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("routerId", routerId)
.add("type", type)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents signaling protocols that are enabled.
*/
public class Signalling {
private final Boolean ldp;
private final Boolean rsvpte;
/**
* Constructor to initialize the values.
*
* @param ldp Label Distribution Protocol whether enabled or not
* @param rsvpte RSVP TE whether enabled or not
*/
public Signalling(Boolean ldp, Boolean rsvpte) {
this.ldp = ldp;
this.rsvpte = rsvpte;
}
/**
* Obtains whether LDP signalling protocol is enabled or not.
*
* @return LDP signalling protocol is enabled or not
*/
public Boolean ldp() {
return ldp;
}
/**
* Obtains whether rsvp-te signalling protocol is enabled or not.
*
* @return rsvp-te signalling protocol is enabled or not
*/
public Boolean rsvpte() {
return rsvpte;
}
@Override
public int hashCode() {
return Objects.hash(ldp, rsvpte);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Signalling) {
Signalling other = (Signalling) obj;
return Objects.equals(ldp, other.ldp) && Objects.equals(rsvpte, other.rsvpte);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("ldp", ldp)
.add("rsvpte", rsvpte)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* Represents Shared Risk Link Group information.
*/
public class Srlg {
private final int srlgGroup;
/**
* Constructor to initialize its parameter.
*
* @param srlgGroup list of Shared Risk Link Group value
*/
public Srlg(int srlgGroup) {
this.srlgGroup = srlgGroup;
}
/**
* Provides Shared Risk link group.
*
* @return Shared Risk link group value
*/
public int srlgGroup() {
return srlgGroup;
}
@Override
public int hashCode() {
return Objects.hash(srlgGroup);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Srlg) {
Srlg other = (Srlg) obj;
return Objects.equals(srlgGroup, other.srlgGroup);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("srlgGroup", srlgGroup)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import java.util.Objects;
import org.onosproject.net.DeviceId;
import org.onosproject.net.ElementId;
import com.google.common.base.MoreObjects;
/**
* Abstraction of a network termination point expressed as a pair of the network element identifier and device
* interface.
*/
public class TerminationPoint {
private final ElementId elementId;
private final DeviceInterface deviceInterface;
/**
* Constructor to initialize its parameters.
*
* @param elementId network element identifier
* @param deviceInterface device interface
*/
public TerminationPoint(ElementId elementId, DeviceInterface deviceInterface) {
this.elementId = elementId;
this.deviceInterface = deviceInterface;
}
/**
* Returns the network element identifier.
*
* @return element identifier
*/
public ElementId elementId() {
return elementId;
}
/**
* Returns the identifier of the infrastructure device if the termination
* point belongs to a network element which is indeed an ip
* device.
*
* @return network element identifier as a device identifier
* @throws java.lang.IllegalStateException if termination point is not
* associated with a device
*/
public DeviceId deviceId() {
if (elementId instanceof DeviceId) {
return (DeviceId) elementId;
}
throw new IllegalStateException("Termination point not associated " +
"with an ip device");
}
/**
* Returns Device interface details.
*
* @return device interface details
*/
public DeviceInterface deviceInterface() {
return deviceInterface;
}
@Override
public int hashCode() {
return Objects.hash(elementId, deviceInterface);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TerminationPoint) {
final TerminationPoint other = (TerminationPoint) obj;
return Objects.equals(this.elementId, other.elementId)
&& Objects.equals(this.deviceInterface, other.deviceInterface);
}
return false;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("elementId", elementId)
.add("deviceInterface", deviceInterface)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api;
import java.util.Objects;
import com.google.common.base.MoreObjects;
/**
* Represents Multi-Topology IDs for a network link, node or prefix.
*/
public class TopologyId {
private final short topologyId;
/**
* Constructor to initialize its parameter.
*
* @param topologyId topology id for node/link/prefix
*/
public TopologyId(short topologyId) {
this.topologyId = topologyId;
}
/**
* Obtains the topology ID.
*
* @return topology ID
*/
public short topologyId() {
return topologyId;
}
@Override
public int hashCode() {
return Objects.hash(topologyId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TopologyId) {
TopologyId other = (TopologyId) obj;
return Objects.equals(topologyId, other.topologyId);
}
return false;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("topologyId", topologyId)
.toString();
}
}
\ No newline at end of file
/*
* 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.iptopology.api.device;
import com.google.common.base.MoreObjects;
import org.onlab.packet.Ip6Address;
import org.onlab.packet.Ip4Address;
import org.onosproject.iptopology.api.InterfaceIdentifier;
import org.onosproject.net.AbstractDescription;
import org.onosproject.net.SparseAnnotations;
/**
* Default implementation of immutable Interface description.
*/
public class DefaultInterfaceDescription extends AbstractDescription
implements InterfaceDescription {
private final InterfaceIdentifier intfId;
private final Ip4Address ipv4Address;
private final Ip6Address ipv6Address;
/**
* Creates an interface description using the supplied information.
*
* @param intfId interface identifier
* @param ipv4Address ipv4 address of an interface
* @param ipv6Address ipv6 address of an interface
* @param annotations optional key/value annotations map
*/
public DefaultInterfaceDescription(InterfaceIdentifier intfId, Ip4Address ipv4Address,
Ip6Address ipv6Address, SparseAnnotations...annotations) {
super(annotations);
this.intfId = intfId;
this.ipv4Address = ipv4Address;
this.ipv6Address = ipv6Address;
}
/**
* Default constructor for serialization.
*/
private DefaultInterfaceDescription() {
this.intfId = null;
this.ipv4Address = null;
this.ipv6Address = null;
}
/**
* Creates an interface description using the supplied information.
*
* @param base InterfaceDescription to get basic information from
* @param annotations optional key/value annotations map
*/
public DefaultInterfaceDescription(InterfaceDescription base,
SparseAnnotations annotations) {
this(base.intfId(), base.ipv4Address(), base.ipv6Address(), annotations);
}
@Override
public InterfaceIdentifier intfId() {
return intfId;
}
@Override
public Ip4Address ipv4Address() {
return ipv4Address;
}
@Override
public Ip6Address ipv6Address() {
return ipv6Address; }
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("intfId", intfId)
.add("ipv4Address", ipv4Address)
.add("ipv6Address", ipv6Address)
.add("annotations", annotations())
.toString();
}
}
/*
* Copyright 2014-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.iptopology.api.device;
import org.onosproject.iptopology.api.DeviceTed;
import org.onosproject.iptopology.api.IpDeviceIdentifier;
import org.onosproject.net.AbstractDescription;
import org.onosproject.net.SparseAnnotations;
import java.net.URI;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.iptopology.api.IpDevice.Type;
/**
* Default implementation of immutable device description entity.
*/
public class DefaultIpDeviceDescription extends AbstractDescription
implements IpDeviceDescription {
private final URI uri;
private final Type type;
private final IpDeviceIdentifier deviceIdentifier;
private final DeviceTed deviceTed;
/**
* Creates an ip device description using the supplied information.
*
* @param uri device URI
* @param type device type
* @param deviceIdentifier device manufacturer
* @param deviceTed device Traffic Engineering parameters
* @param annotations optional key/value annotations map
*/
public DefaultIpDeviceDescription(URI uri, Type type, IpDeviceIdentifier deviceIdentifier,
DeviceTed deviceTed, SparseAnnotations... annotations) {
super(annotations);
this.uri = checkNotNull(uri, "Device URI cannot be null");
this.type = checkNotNull(type, "Device type cannot be null");
this.deviceIdentifier = deviceIdentifier;
this.deviceTed = deviceTed;
}
/**
* Creates an ip device description using the supplied information.
* @param base IpDeviceDescription to basic information
* @param annotations Annotations to use.
*/
public DefaultIpDeviceDescription(IpDeviceDescription base, SparseAnnotations... annotations) {
this(base.deviceURI(), base.type(), base.deviceIdentifier(),
base.deviceTed(), annotations);
}
/**
* Creates an ip device description using the supplied information.
* @param base IpDeviceDescription to basic information (except for type)
* @param type device type
* @param annotations Annotations to use.
*/
public DefaultIpDeviceDescription(IpDeviceDescription base, Type type, SparseAnnotations... annotations) {
this(base.deviceURI(), type, base.deviceIdentifier(),
base.deviceTed(), annotations);
}
@Override
public URI deviceURI() {
return uri;
}
@Override
public Type type() {
return type;
}
@Override
public IpDeviceIdentifier deviceIdentifier() {
return deviceIdentifier;
}
@Override
public DeviceTed deviceTed() {
return deviceTed;
}
@Override
public String toString() {
return toStringHelper(this)
.add("uri", uri)
.add("type", type)
.add("devid", deviceIdentifier)
.add("devTed", deviceTed)
.toString();
}
/**
* Default constructor for serialization.
*/
private DefaultIpDeviceDescription() {
this.uri = null;
this.type = null;
this.deviceIdentifier = null;
this.deviceTed = null;
}
}
/*
* 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.iptopology.api.device;
import com.google.common.base.MoreObjects;
import org.onosproject.iptopology.api.PrefixIdentifier;
import org.onosproject.iptopology.api.PrefixTed;
import org.onosproject.net.AbstractDescription;
import org.onosproject.net.SparseAnnotations;
/**
* Default implementation of immutable Prefix description.
*/
public class DefaultPrefixDescription extends AbstractDescription
implements PrefixDescription {
private final PrefixIdentifier prefixIdentifier;
private final PrefixTed prefixTed;
/**
* Creates prefix description using the supplied information.
*
* @param prefixIdentifier prefix identifier
* @param prefixTed prefix traffic engineering parameters
* @param annotations optional key/value annotations map
*/
public DefaultPrefixDescription(PrefixIdentifier prefixIdentifier, PrefixTed prefixTed,
SparseAnnotations...annotations) {
super(annotations);
this.prefixIdentifier = prefixIdentifier;
this.prefixTed = prefixTed;
}
/**
* Default constructor for serialization.
*/
private DefaultPrefixDescription() {
this.prefixIdentifier = null;
this.prefixTed = null;
}
/**
* Creates prefix description using the supplied information.
*
* @param base PrefixDescription to get basic information from
* @param annotations optional key/value annotations map
*/
public DefaultPrefixDescription(PrefixDescription base,
SparseAnnotations annotations) {
this(base.prefixIdentifier(), base.prefixTed(), annotations);
}
@Override
public PrefixIdentifier prefixIdentifier() {
return prefixIdentifier;
}
@Override
public PrefixTed prefixTed() {
return prefixTed;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("prefixIdentifier", prefixIdentifier)
.add("prefixTed", prefixTed)
.add("annotations", annotations())
.toString();
}
}
/*
* 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.iptopology.api.device;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import org.onosproject.iptopology.api.InterfaceIdentifier;
import org.onosproject.net.Description;
/**
* Information about an interface.
*/
public interface InterfaceDescription extends Description {
/**
* Returns the IPv4 Address of an interface.
*
* @return ipv4 address
*/
Ip4Address ipv4Address();
/**
* Returns the IPv6 Address of an interface.
*
* @return ipv6 address
*/
Ip6Address ipv6Address();
/**
* Returns the interface id of the interface.
*
* @return interface identifier
*/
InterfaceIdentifier intfId();
}
/*
* Copyright 2014-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.iptopology.api.device;
import org.onosproject.iptopology.api.DeviceTed;
import org.onosproject.iptopology.api.IpDevice;
import org.onosproject.iptopology.api.IpDeviceIdentifier;
import org.onosproject.net.Description;
import java.net.URI;
/**
* Carrier of immutable information about an ip device.
*/
public interface IpDeviceDescription extends Description {
/**
* Protocol/provider specific URI that can be used to encode the identity
* information required to communicate with the ip device externally, e.g.
* datapath ID.
*
* @return provider specific URI for the ip device
*/
URI deviceURI();
/**
* Returns the type of the ip device. For ex: Psuedo or actual
*
* @return type of the device
*/
IpDevice.Type type();
/**
* Returns the device identifier details.
*
* @return identifier of the device
*/
IpDeviceIdentifier deviceIdentifier();
/**
* Returns the traffic engineering parameters of the device.
*
* @return traffic engineering parameters of the device
*/
DeviceTed deviceTed();
}
/*
* Copyright 2014-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.iptopology.api.device;
import org.joda.time.LocalDateTime;
import org.onosproject.event.AbstractEvent;
import org.onosproject.iptopology.api.DeviceIntf;
import org.onosproject.iptopology.api.DevicePrefix;
import org.onosproject.iptopology.api.IpDevice;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Describes ip device event.
*/
public class IpDeviceEvent extends AbstractEvent<IpDeviceEvent.Type, IpDevice> {
private final DeviceIntf devInterface;
private final DevicePrefix devicePrefix;
/**
* Type of device events.
*/
public enum Type {
/**
* Signifies that a new device has been detected.
*/
DEVICE_ADDED,
/**
* Signifies that some device attributes have changed; excludes
* availability changes.
*/
DEVICE_UPDATED,
/**
* Signifies that a device has been removed.
*/
DEVICE_REMOVED,
/**
* Signifies that an interface has been added.
*/
INTERFACE_ADDED,
/**
* Signifies that an interface has been updated.
*/
INTERFACE_UPDATED,
/**
* Signifies that an interface has been removed.
*/
INTERFACE_REMOVED,
/**
* Signifies that a prefix has been added.
*/
PREFIX_ADDED,
/**
* Signifies that a prefix has been updated.
*/
PREFIX_UPDATED,
/**
* Signifies that a prefix has been removed.
*/
PREFIX_REMOVED,
}
/**
* Creates an event of a given type and for the specified ip device.
*
* @param type device event type
* @param device event device subject
*/
public IpDeviceEvent(Type type, IpDevice device) {
this(type, device, null, null);
}
/**
* Creates an event of a given type and for the specified device and interface.
*
* @param type device event type
* @param device event device subject
* @param devInterface optional interface subject
*/
public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface) {
this(type, device, devInterface, null);
}
/**
* Creates an event of a given type and for the specified device and interface.
*
* @param type device event type
* @param device event device subject
* @param devicePrefix optional prefix subject
*/
public IpDeviceEvent(Type type, IpDevice device, DevicePrefix devicePrefix) {
this(type, device, null, devicePrefix);
}
/**
* Creates an event of a given type and for the specified device, interface and prefix.
*
* @param type device event type
* @param device event device subject
* @param devInterface optional interface subject
* @param devicePrefix optional prefix subject
*/
public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface, DevicePrefix devicePrefix) {
super(type, device);
this.devInterface = devInterface;
this.devicePrefix = devicePrefix;
}
/**
* Creates an event of a given type and for the specified device, interface and time.
*
* @param type device event type
* @param device event device subject
* @param devInterface optional interface subject
* @param devicePrefix optional prefix subject
* @param time occurrence time
*/
public IpDeviceEvent(Type type, IpDevice device, DeviceIntf devInterface, DevicePrefix devicePrefix, long time) {
super(type, device, time);
this.devInterface = devInterface;
this.devicePrefix = devicePrefix;
}
/**
* Returns the interface subject.
*
* @return interface subject or null if the event is not interface specific.
*/
public DeviceIntf deviceInterface() {
return devInterface;
}
/**
* Returns the prefix subject.
*
* @return prefix subject or null if the event is not prefix specific.
*/
public DevicePrefix prefix() {
return devicePrefix;
}
@Override
public String toString() {
if (devInterface == null || devicePrefix == null) {
return super.toString();
}
return toStringHelper(this)
.add("time", new LocalDateTime(time()))
.add("type", type())
.add("subject", subject())
.add("interface", devInterface)
.add("prefix", devicePrefix)
.toString();
}
}
/*
* 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.iptopology.api.device;
import org.onosproject.event.EventListener;
/**
* Entity capable of receiving ip device related events.
*/
public interface IpDeviceListener extends EventListener<IpDeviceEvent> {
}
/*
* 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.iptopology.api.device;
import org.onosproject.net.provider.Provider;
/**
* Abstraction of a ip device information provider.
*/
public interface IpDeviceProvider extends Provider {
// Currently there is none to set some information into the network
}
/*
* 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.iptopology.api.device;
import org.onosproject.net.provider.ProviderRegistry;
/**
* Abstraction of a ip device provider registry.
*/
public interface IpDeviceProviderRegistry
extends ProviderRegistry<IpDeviceProvider, IpDeviceProviderService> {
}
/*
* Copyright 2014-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.iptopology.api.device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.provider.ProviderService;
import java.util.List;
/**
* Service through which ip device providers can inject ip device information into
* the core.
*/
public interface IpDeviceProviderService extends ProviderService<IpDeviceProvider> {
/**
* Signals the core that an ip device is added or updated with IP topology information.
*
* @param deviceId device identifier
* @param deviceDescription information about network ip device
*/
void addOrUpdateIpDevice(DeviceId deviceId, IpDeviceDescription deviceDescription);
/**
* Signals the core that an ip device is removed.
*
* @param deviceId identity of the ip device to be removed
*/
void removeIpDevice(DeviceId deviceId);
/**
* Sends information about all interfaces of a device. It is up to the core to
* determine what has changed.
*
* @param deviceId identity of the ip device
* @param interfaceDescriptions list of device interfaces
*/
void updateInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions);
/**
* signals interfaces of a device is deleted.
*
* @param deviceId identity of the ip device
* @param interfaceDescriptions list of device interfaces
*/
void removeInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions);
/**
* Sends information about all ip prefix of a device. It is up to the core to
* determine what has changed.
*
* @param deviceId identity of the ip device
* @param prefixDescriptions list of device ip prefixes
*/
void updatePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions);
/**
* signals ip prefix of a device is deleted.
*
* @param deviceId identity of the ip device
* @param prefixDescriptions list of device ip prefixes
*/
void removePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions);
}
/*
* Copyright 2014-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.iptopology.api.device;
import org.onosproject.event.ListenerService;
import org.onosproject.iptopology.api.DeviceIntf;
import org.onosproject.iptopology.api.DevicePrefix;
import org.onosproject.iptopology.api.InterfaceIdentifier;
import org.onosproject.iptopology.api.IpDevice;
import org.onosproject.net.DeviceId;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import java.util.List;
/**
* Service for interacting with the inventory of ip devices.
*/
public interface IpDeviceService
extends ListenerService<IpDeviceEvent, IpDeviceListener> {
/**
* Returns the number of ip devices known to the system.
*
* @return number of infrastructure devices
*/
int getIpDeviceCount();
/**
* Returns a collection of the currently known ip
* devices.
*
* @return collection of devices
*/
Iterable<IpDevice> getIpDevices();
/**
* Returns a collection of the currently known ip
* devices by device type.
*
* @param type device type
* @return collection of devices
*/
Iterable<IpDevice> getIpDevices(IpDevice.Type type);
/**
* Returns the ip device with the specified identifier.
*
* @param deviceId device identifier
* @return device or null if one with the given identifier is not known
*/
IpDevice getIpDevice(DeviceId deviceId);
/**
* Returns the list of interfaces associated with the device.
*
* @param deviceId device identifier
* @return list of device interfaces
*/
List<DeviceIntf> getInterfaces(DeviceId deviceId);
/**
* Returns the interface with the specified ipv4 address and hosted by the given device.
*
* @param deviceId device identifier
* @param ipv4Address ipv4 address
* @return device interface
*/
DeviceIntf getInterface(DeviceId deviceId, Ip4Address ipv4Address);
/**
* Returns the interface with the specified ipv6 address and hosted by the given device.
*
* @param deviceId device identifier
* @param ipv6Address ipv6 address
* @return device interface
*/
DeviceIntf getInterface(DeviceId deviceId, Ip6Address ipv6Address);
/**
* Returns the interface with the specified interface id and hosted by the given device.
*
* @param deviceId device identifier
* @param intfId interface id
* @return device interface
*/
DeviceIntf getInterface(DeviceId deviceId, InterfaceIdentifier intfId);
/**
* Returns the list of ip prefix associated with the device.
*
* @param deviceId device identifier
* @return list of device prefixes
*/
List<DevicePrefix> getPrefixes(DeviceId deviceId);
}
/*
* Copyright 2014-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.iptopology.api.device;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import org.onosproject.iptopology.api.DevicePrefix;
import org.onosproject.iptopology.api.InterfaceIdentifier;
import org.onosproject.iptopology.api.IpDevice;
import org.onosproject.iptopology.api.DeviceIntf;
import org.onosproject.net.DeviceId;
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.Store;
import java.util.List;
/**
* Manages inventory of ip devices; not intended for direct use.
*/
public interface IpDeviceStore extends Store<IpDeviceEvent, IpDeviceStoreDelegate> {
/**
* Returns the number of ip devices known to the system.
*
* @return number of ip devices
*/
int getIpDeviceCount();
/**
* Returns an iterable collection of all ip devices known to the system.
*
* @return ip device collection
*/
Iterable<IpDevice> getIpDevices();
/**
* Returns an ip device with the specified identifier.
*
* @param deviceId device identifier
* @return ip device
*/
IpDevice getIpDevice(DeviceId deviceId);
/**
* Creates a new infrastructure ip device, or updates an existing one using
* the supplied device description.
*
* @param providerId provider identifier
* @param deviceId device identifier
* @param deviceDescription device description
* @return ready to send event describing what occurred; null if no change
*/
IpDeviceEvent createOrUpdateIpDevice(ProviderId providerId, DeviceId deviceId,
IpDeviceDescription deviceDescription);
/**
* Administratively removes the specified ip device from the store.
*
* @param deviceId device to be removed
* @return null if no such ip device
*/
IpDeviceEvent removeIpDevice(DeviceId deviceId);
/**
* Updates the interface of the specified ip device using the given
* list of interface descriptions. The list is assumed to be comprehensive.
*
* @param providerId provider identifier
* @param deviceId ip device identifier
* @param interfaceDescriptions list of interface descriptions
* @return ready to send events describing what occurred; empty list if no change
*/
List<IpDeviceEvent> updateInterfaces(ProviderId providerId, DeviceId deviceId,
List<InterfaceDescription> interfaceDescriptions);
/**
* Administratively removes the specified interface from the store.
*
* @param deviceId device of the interfaces to be removed
* @param interfaceDescriptions list of interface descriptions
* @return ready to send events describing what occurred.
*/
List<IpDeviceEvent> removeInterfaces(DeviceId deviceId, List<InterfaceDescription> interfaceDescriptions);
/**
* Returns the list of interfaces that belong to the specified device.
*
* @param deviceId device identifier
* @return list of device interfaces
*/
List<DeviceIntf> getInterfaces(DeviceId deviceId);
/**
* Returns the specified device interface.
*
* @param deviceId device identifier
* @param ipv4Address ipv4 address of the interface
* @return device interface
*/
DeviceIntf getInterface(DeviceId deviceId, Ip4Address ipv4Address);
/**
* Returns the specified device interface.
*
* @param deviceId device identifier
* @param ipv6Address ipv6 address of the interface
* @return device interface
*/
DeviceIntf getInterface(DeviceId deviceId, Ip6Address ipv6Address);
/**
* Returns the specified device interface.
*
* @param deviceId device identifier
* @param intfId interface identifier of the interface
* @return device interface
*/
DeviceIntf getInterface(DeviceId deviceId, InterfaceIdentifier intfId);
/**
* Updates the prefix information of the specified ip device using the given
* list of prefix descriptions. The list is assumed to be comprehensive.
*
* @param providerId provider identifier
* @param deviceId ip device identifier
* @param prefixDescriptions list of prefix descriptions
* @return ready to send events describing what occurred; empty list if no change
*/
List<IpDeviceEvent> updatePrefixes(ProviderId providerId, DeviceId deviceId,
List<PrefixDescription> prefixDescriptions);
/**
* Administratively removes the specified prefix from the store.
*
* @param deviceId device of the prefix to be removed
* @param prefixDescriptions list of prefix descriptions
* @return ready to send events describing what occurred.
*/
List<IpDeviceEvent> removePrefixes(DeviceId deviceId, List<PrefixDescription> prefixDescriptions);
/**
* Returns the list of prefixes that belong to the specified device.
*
* @param deviceId device identifier
* @return list of device prefixes
*/
List<DevicePrefix> getPrefixes(DeviceId deviceId);
}
/*
* 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.iptopology.api.device;
import org.onosproject.store.StoreDelegate;
/**
* Infrastructure ip topology store delegate abstraction.
*/
public interface IpDeviceStoreDelegate extends StoreDelegate<IpDeviceEvent> {
}
/*
* 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.iptopology.api.device;
import org.onosproject.iptopology.api.PrefixIdentifier;
import org.onosproject.iptopology.api.PrefixTed;
import org.onosproject.net.Description;
/**
* Information about a prefix.
*/
public interface PrefixDescription extends Description {
/**
* Returns the prefix identifier.
*
* @return prefix identifier
*/
PrefixIdentifier prefixIdentifier();
/**
* Returns the prefix Traffic Engineering parameters.
*
* @return prefix Traffic Engineering parameters
*/
PrefixTed prefixTed();
}
/*
* 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.
*/
/**
* Ip device model &amp; related services API definitions.
*/
package org.onosproject.iptopology.api.device;
/*
* 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.iptopology.api.link;
import com.google.common.base.MoreObjects;
import org.onosproject.iptopology.api.IpLinkIdentifier;
import org.onosproject.iptopology.api.LinkTed;
import org.onosproject.iptopology.api.TerminationPoint;
import org.onosproject.net.AbstractDescription;
import org.onosproject.net.SparseAnnotations;
/**
* Default implementation of immutable ip link description entity.
*/
public class DefaultIpLinkDescription extends AbstractDescription
implements IpLinkDescription {
private final TerminationPoint src;
private final TerminationPoint dst;
private final IpLinkIdentifier linkIdentifier;
private final LinkTed linkTed;
/**
* Creates an ip link description using the supplied information.
*
* @param src link source
* @param dst link destination
* @param linkIdentifier link identifier
* @param linkTed link traffic engineering parameters
* @param annotations optional key/value annotations
*/
public DefaultIpLinkDescription(TerminationPoint src, TerminationPoint dst,
IpLinkIdentifier linkIdentifier, LinkTed linkTed,
SparseAnnotations... annotations) {
super(annotations);
this.src = src;
this.dst = dst;
this.linkIdentifier = linkIdentifier;
this.linkTed = linkTed;
}
/**
* Creates an ip link description using the supplied information.
*
* @param base IpLinkDescription to basic information
* @param annotations optional key/value annotations
*/
public DefaultIpLinkDescription(IpLinkDescription base, SparseAnnotations... annotations) {
this(base.src(), base.dst(), base.linkIdentifier(),
base.linkTed(), annotations);
}
@Override
public TerminationPoint src() {
return src;
}
@Override
public TerminationPoint dst() {
return dst;
}
@Override
public IpLinkIdentifier linkIdentifier() {
return linkIdentifier;
}
@Override
public LinkTed linkTed() {
return linkTed; }
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("src", src())
.add("dst", dst())
.add("linkIdentifier", linkIdentifier())
.add("linkTed", linkTed())
.toString();
}
}
/*
* 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.iptopology.api.link;
import org.onosproject.iptopology.api.IpLinkIdentifier;
import org.onosproject.iptopology.api.LinkTed;
import org.onosproject.iptopology.api.TerminationPoint;
import org.onosproject.net.Description;
/**
* Describes an ip link.
*/
public interface IpLinkDescription extends Description {
/**
* Returns the link source.
*
* @return links source
*/
TerminationPoint src();
/**
* Returns the link destination.
*
* @return links destination
*/
TerminationPoint dst();
/**
* Returns the link identifier.
*
* @return links identifier informations
*/
IpLinkIdentifier linkIdentifier();
/**
* Returns the link traffic engineering parameters.
*
* @return links traffic engineering parameters
*/
LinkTed linkTed();
}
/*
* 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.iptopology.api.link;
import org.onosproject.event.AbstractEvent;
import org.onosproject.iptopology.api.IpLink;
/**
* Describes ip link event.
*/
public class IpLinkEvent extends AbstractEvent<IpLinkEvent.Type, IpLink> {
/**
* Type of link events.
*/
public enum Type {
/**
* Signifies that a new ip link has been detected.
*/
LINK_ADDED,
/**
* Signifies that an ip link has been updated or changed state.
*/
LINK_UPDATED,
/**
* Signifies that an ip link has been removed.
*/
LINK_REMOVED
}
/**
* Creates an event of a given type and for the specified ip link and the
* current time.
*
* @param type link event type
* @param link event link subject
*/
public IpLinkEvent(Type type, IpLink link) {
super(type, link);
}
/**
* Creates an event of a given type and for the specified ip link and time.
*
* @param type link event type
* @param link event link subject
* @param time occurrence time
*/
public IpLinkEvent(Type type, IpLink link, long time) {
super(type, link, time);
}
}
/*
* 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.iptopology.api.link;
import org.onosproject.event.EventListener;
/**
* Entity capable of receiving ip link related events.
*/
public interface IpLinkListener extends EventListener<IpLinkEvent> {
}
/*
* 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.iptopology.api.link;
import org.onosproject.net.provider.Provider;
/**
* Abstraction of an entity providing information about ip links
* to the core.
*/
public interface IpLinkProvider extends Provider {
}
/*
* 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.iptopology.api.link;
import org.onosproject.net.provider.ProviderRegistry;
/**
* Abstraction of an ip link provider registry.
*/
public interface IpLinkProviderRegistry
extends ProviderRegistry<IpLinkProvider, IpLinkProviderService> {
}
/*
* 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.iptopology.api.link;
import org.onosproject.iptopology.api.TerminationPoint;
import org.onosproject.net.DeviceId;
import org.onosproject.net.provider.ProviderService;
/**
* Means for injecting ip link information into the core.
*/
public interface IpLinkProviderService extends ProviderService<IpLinkProvider> {
/**
* Signals that an ip link is added or updated with IP topology information.
*
* @param linkDescription ip link information
*/
void addOrUpdateIpLink(IpLinkDescription linkDescription);
/**
* Signals that an ip link has disappeared.
*
* @param linkDescription ip link information
*/
void removeIpLink(IpLinkDescription linkDescription);
/**
* Signals that ip links associated with the specified
* termination point have vanished.
*
* @param terminationPoint termination point
*/
void removeIpLink(TerminationPoint terminationPoint);
/**
* Signals that ip links associated with the specified
* device have vanished.
*
* @param deviceId device identifier
*/
void removeIpLink(DeviceId deviceId);
}
This diff is collapsed. Click to expand it.