Madan Jampani
Committed by Gerrit Code Review

Fix files with windows line endings + Add checkstyle rule to catch this issue

Change-Id: Ic1905f2121c5c2ab66259f7f531c1e36fe58e9d4
Showing 39 changed files with 2503 additions and 2503 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.
*/
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();
}
/*
* 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();
}
/*
* 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;
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();
}
/*
* 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();
}
/*
* 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();
}
/*
* 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 providerId provider identification
* @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();
}
/*
* 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 providerId provider identification
* @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();
}
/*
* 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();
/*
* 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();
/*
* 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.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();
}
/*
* 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 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();
/*
* 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 routeDish routing distinguisher instance
* @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();
}
/*
* 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 routeDish routing distinguisher instance
* @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();
/*
* 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;
/**
* 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();
}
/*
* 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 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();
}
/*
* 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 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.mfwd.cli;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.mfwd.impl.McastForwarding;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.mcast.McastRoute;
import org.onosproject.net.mcast.MulticastRouteService;
/**
* Installs a source, multicast group flow.
*/
@Command(scope = "onos", name = "mcast-join",
description = "Installs a source, multicast group flow")
public class McastJoinCommand extends AbstractShellCommand {
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
MulticastRouteService mcastRouteManager = AbstractShellCommand.get(MulticastRouteService.class);
@Argument(index = 0, name = "sAddr",
description = "IP Address of the multicast source. '*' can be used for any source (*, G) entry",
required = true, multiValued = false)
String sAddr = null;
@Argument(index = 1, name = "gAddr",
description = "IP Address of the multicast group",
required = true, multiValued = false)
String gAddr = null;
@Argument(index = 2, name = "ingressPort",
description = "Ingress port of:XXXXXXXXXX/XX",
required = false, multiValued = false)
String ingressPort = null;
@Argument(index = 3, name = "ports",
description = "Egress ports of:XXXXXXXXXX/XX...",
required = false, multiValued = true)
String[] ports = null;
@Override
protected void execute() {
McastRoute mRoute = McastForwarding.createStaticRoute(sAddr, gAddr);
mcastRouteManager.add(mRoute);
ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressPort);
mcastRouteManager.addSource(mRoute, ingress);
for (String egCP : ports) {
log.debug("Egress port provided: " + egCP);
ConnectPoint egress = ConnectPoint.deviceConnectPoint(egCP);
mcastRouteManager.addSink(mRoute, egress);
}
print("Added the mcast route");
}
}
/*
* 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.mfwd.cli;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.mfwd.impl.McastForwarding;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.mcast.McastRoute;
import org.onosproject.net.mcast.MulticastRouteService;
/**
* Installs a source, multicast group flow.
*/
@Command(scope = "onos", name = "mcast-join",
description = "Installs a source, multicast group flow")
public class McastJoinCommand extends AbstractShellCommand {
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
MulticastRouteService mcastRouteManager = AbstractShellCommand.get(MulticastRouteService.class);
@Argument(index = 0, name = "sAddr",
description = "IP Address of the multicast source. '*' can be used for any source (*, G) entry",
required = true, multiValued = false)
String sAddr = null;
@Argument(index = 1, name = "gAddr",
description = "IP Address of the multicast group",
required = true, multiValued = false)
String gAddr = null;
@Argument(index = 2, name = "ingressPort",
description = "Ingress port of:XXXXXXXXXX/XX",
required = false, multiValued = false)
String ingressPort = null;
@Argument(index = 3, name = "ports",
description = "Egress ports of:XXXXXXXXXX/XX...",
required = false, multiValued = true)
String[] ports = null;
@Override
protected void execute() {
McastRoute mRoute = McastForwarding.createStaticRoute(sAddr, gAddr);
mcastRouteManager.add(mRoute);
ConnectPoint ingress = ConnectPoint.deviceConnectPoint(ingressPort);
mcastRouteManager.addSource(mRoute, ingress);
for (String egCP : ports) {
log.debug("Egress port provided: " + egCP);
ConnectPoint egress = ConnectPoint.deviceConnectPoint(egCP);
mcastRouteManager.addSink(mRoute, egress);
}
print("Added the mcast route");
}
}
......
/**
* Sample Multicast forwarding framework using intents.
*/
package org.onosproject.mfwd.cli;
/**
* Sample Multicast forwarding framework using intents.
*/
package org.onosproject.mfwd.cli;
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import java.util.List;
/**
* Representation of a Router.
*/
public interface Router {
/**
* Coarse classification of the type of the Router.
*/
public enum Status {
/**
* Signifies that a router is currently active.
*/
ACTIVE,
/**
* Signifies that a router is currently inactive.
*/
INACTIVE
}
/**
* Returns the router identifier.
*
* @return identifier
*/
RouterId id();
/**
* Returns the router Name.
*
* @return routerName
*/
String name();
/**
* Returns the router admin state.
*
* @return true or false
*/
boolean adminStateUp();
/**
* Returns the status of router.
*
* @return RouterStatus
*/
Status status();
/**
* Returns the distributed status of this router.
* If true, indicates a distributed router.
*
* @return true or false
*/
boolean distributed();
/**
* Returns the RouterGateway of router.
*
* @return routerGateway
*/
RouterGateway externalGatewayInfo();
/**
* Returns the gatewayPortid of router.
*
* @return virtualPortId
*/
VirtualPortId gatewayPortid();
/**
* Returns the owner(tenant) of this router.
*
* @return tenantId
*/
TenantId tenantId();
/**
* Returns the router list of router.
*
* @return routes
*/
List<String> routes();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import java.util.List;
/**
* Representation of a Router.
*/
public interface Router {
/**
* Coarse classification of the type of the Router.
*/
public enum Status {
/**
* Signifies that a router is currently active.
*/
ACTIVE,
/**
* Signifies that a router is currently inactive.
*/
INACTIVE
}
/**
* Returns the router identifier.
*
* @return identifier
*/
RouterId id();
/**
* Returns the router Name.
*
* @return routerName
*/
String name();
/**
* Returns the router admin state.
*
* @return true or false
*/
boolean adminStateUp();
/**
* Returns the status of router.
*
* @return RouterStatus
*/
Status status();
/**
* Returns the distributed status of this router.
* If true, indicates a distributed router.
*
* @return true or false
*/
boolean distributed();
/**
* Returns the RouterGateway of router.
*
* @return routerGateway
*/
RouterGateway externalGatewayInfo();
/**
* Returns the gatewayPortid of router.
*
* @return virtualPortId
*/
VirtualPortId gatewayPortid();
/**
* Returns the owner(tenant) of this router.
*
* @return tenantId
*/
TenantId tenantId();
/**
* Returns the router list of router.
*
* @return routes
*/
List<String> routes();
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collection;
import java.util.Objects;
/**
* Representation of a Router gateway.
*/
public final class RouterGateway {
private final TenantNetworkId networkId;
private final boolean enableSnat;
private final Collection<FixedIp> externalFixedIps;
// Public construction is prohibited
private RouterGateway(TenantNetworkId networkId, boolean enableSnat,
Collection<FixedIp> externalFixedIps) {
this.networkId = checkNotNull(networkId, "networkId cannot be null");
this.enableSnat = checkNotNull(enableSnat, "enableSnat cannot be null");
this.externalFixedIps = checkNotNull(externalFixedIps, "externalFixedIps cannot be null");
}
/**
* Creates router gateway object.
*
* @param networkId network identifier
* @param enableSnat SNAT enable or not
* @param externalFixedIps external fixed IP
* @return RouterGateway
*/
public static RouterGateway routerGateway(TenantNetworkId networkId, boolean enableSnat,
Collection<FixedIp> externalFixedIps) {
return new RouterGateway(networkId, enableSnat, externalFixedIps);
}
/**
* Returns network identifier.
*
* @return networkId
*/
public TenantNetworkId networkId() {
return networkId;
}
/**
* Return SNAT enable or not.
*
* @return enableSnat
*/
public boolean enableSnat() {
return enableSnat;
}
/**
* Return external fixed Ip.
*
* @return externalFixedIps
*/
public Collection<FixedIp> externalFixedIps() {
return externalFixedIps;
}
@Override
public int hashCode() {
return Objects.hash(networkId, enableSnat, externalFixedIps);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof RouterGateway) {
final RouterGateway that = (RouterGateway) obj;
return Objects.equals(this.networkId, that.networkId)
&& Objects.equals(this.enableSnat, that.enableSnat)
&& Objects.equals(this.externalFixedIps, that.externalFixedIps);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("networkId", networkId)
.add("enableSnat", enableSnat)
.add("externalFixedIps", externalFixedIps)
.toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collection;
import java.util.Objects;
/**
* Representation of a Router gateway.
*/
public final class RouterGateway {
private final TenantNetworkId networkId;
private final boolean enableSnat;
private final Collection<FixedIp> externalFixedIps;
// Public construction is prohibited
private RouterGateway(TenantNetworkId networkId, boolean enableSnat,
Collection<FixedIp> externalFixedIps) {
this.networkId = checkNotNull(networkId, "networkId cannot be null");
this.enableSnat = checkNotNull(enableSnat, "enableSnat cannot be null");
this.externalFixedIps = checkNotNull(externalFixedIps, "externalFixedIps cannot be null");
}
/**
* Creates router gateway object.
*
* @param networkId network identifier
* @param enableSnat SNAT enable or not
* @param externalFixedIps external fixed IP
* @return RouterGateway
*/
public static RouterGateway routerGateway(TenantNetworkId networkId, boolean enableSnat,
Collection<FixedIp> externalFixedIps) {
return new RouterGateway(networkId, enableSnat, externalFixedIps);
}
/**
* Returns network identifier.
*
* @return networkId
*/
public TenantNetworkId networkId() {
return networkId;
}
/**
* Return SNAT enable or not.
*
* @return enableSnat
*/
public boolean enableSnat() {
return enableSnat;
}
/**
* Return external fixed Ip.
*
* @return externalFixedIps
*/
public Collection<FixedIp> externalFixedIps() {
return externalFixedIps;
}
@Override
public int hashCode() {
return Objects.hash(networkId, enableSnat, externalFixedIps);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof RouterGateway) {
final RouterGateway that = (RouterGateway) obj;
return Objects.equals(this.networkId, that.networkId)
&& Objects.equals(this.enableSnat, that.enableSnat)
&& Objects.equals(this.externalFixedIps, that.externalFixedIps);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("networkId", networkId)
.add("enableSnat", enableSnat)
.add("externalFixedIps", externalFixedIps)
.toString();
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.util;
import org.onosproject.store.service.EventuallyConsistentMapBuilder;
import org.onosproject.store.service.ConsistentMapBuilder;
import org.onosproject.store.service.DistributedSetBuilder;
import org.onosproject.store.service.DistributedQueueBuilder;
import org.onosproject.store.service.AtomicCounterBuilder;
import org.onosproject.store.service.AtomicValueBuilder;
import org.onosproject.store.service.TransactionContextBuilder;
import org.onosproject.store.service.StorageService;
/**
* Adapter for the storage service.
*/
public class VtnStorageServiceAdapter implements StorageService {
@Override
public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
return null;
}
@Override
public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
return null;
}
@Override
public <E> DistributedSetBuilder<E> setBuilder() {
return null;
}
@Override
public <E> DistributedQueueBuilder<E> queueBuilder() {
return null;
}
@Override
public AtomicCounterBuilder atomicCounterBuilder() {
return null;
}
@Override
public <V> AtomicValueBuilder<V> atomicValueBuilder() {
return null;
}
@Override
public TransactionContextBuilder transactionContextBuilder() {
return null;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.util;
import org.onosproject.store.service.EventuallyConsistentMapBuilder;
import org.onosproject.store.service.ConsistentMapBuilder;
import org.onosproject.store.service.DistributedSetBuilder;
import org.onosproject.store.service.DistributedQueueBuilder;
import org.onosproject.store.service.AtomicCounterBuilder;
import org.onosproject.store.service.AtomicValueBuilder;
import org.onosproject.store.service.TransactionContextBuilder;
import org.onosproject.store.service.StorageService;
/**
* Adapter for the storage service.
*/
public class VtnStorageServiceAdapter implements StorageService {
@Override
public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
return null;
}
@Override
public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
return null;
}
@Override
public <E> DistributedSetBuilder<E> setBuilder() {
return null;
}
@Override
public <E> DistributedQueueBuilder<E> queueBuilder() {
return null;
}
@Override
public AtomicCounterBuilder atomicCounterBuilder() {
return null;
}
@Override
public <V> AtomicValueBuilder<V> atomicValueBuilder() {
return null;
}
@Override
public TransactionContextBuilder transactionContextBuilder() {
return null;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.util;
import org.onosproject.store.service.EventuallyConsistentMapBuilder;
public class VtnStorageServiceTest extends VtnStorageServiceAdapter {
@Override
public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
return VtnEventuallyConsistentMapTest.builder();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.vtnrsc.util;
import org.onosproject.store.service.EventuallyConsistentMapBuilder;
public class VtnStorageServiceTest extends VtnStorageServiceAdapter {
@Override
public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
return VtnEventuallyConsistentMapTest.builder();
}
}
......
/*
* 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.net.flow;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Default flow entry class with FlowLiveType value, IMMEDIATE_FLOW, SHORT_FLOW, MID_FLOW, LONG_FLOW.
*/
public class DefaultTypedFlowEntry extends DefaultFlowEntry
implements TypedStoredFlowEntry {
private FlowLiveType liveType;
/**
* Creates a typed flow entry from flow rule and its statistics, with default flow live type(IMMEDIATE_FLOW).
*
* @param rule the flow rule
* @param state the flow state
* @param life the flow duration since creation
* @param packets the flow packets count
* @param bytes the flow bytes count
*
*/
public DefaultTypedFlowEntry(FlowRule rule, FlowEntryState state,
long life, long packets, long bytes) {
super(rule, state, life, packets, bytes);
this.liveType = FlowLiveType.IMMEDIATE_FLOW;
}
/**
* Creates a typed flow entry from flow rule, with default flow live type(IMMEDIATE_FLOW).
*
* @param rule the flow rule
*
*/
public DefaultTypedFlowEntry(FlowRule rule) {
super(rule);
this.liveType = FlowLiveType.IMMEDIATE_FLOW;
}
/**
* Creates a typed flow entry from flow entry, with default flow live type(IMMEDIATE_FLOW).
*
* @param fe the flow entry
*
*/
public DefaultTypedFlowEntry(FlowEntry fe) {
super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
this.liveType = FlowLiveType.IMMEDIATE_FLOW;
}
/**
* Creates a typed flow entry from flow rule and flow live type.
*
* @param rule the flow rule
* @param liveType the flow live type
*
*/
public DefaultTypedFlowEntry(FlowRule rule, FlowLiveType liveType) {
super(rule);
this.liveType = liveType;
}
/**
* Creates a typed flow entry from flow entry and flow live type.
*
* @param fe the flow rule
* @param liveType the flow live type
*
*/
public DefaultTypedFlowEntry(FlowEntry fe, FlowLiveType liveType) {
super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
this.liveType = liveType;
}
/**
* Creates a typed flow entry from flow rule, error code and flow live type.
*
* @param rule the flow rule
* @param errType the flow error type
* @param errCode the flow error code
* @param liveType the flow live type
*
*/
public DefaultTypedFlowEntry(FlowRule rule, int errType, int errCode, FlowLiveType liveType) {
super(rule, errType, errCode);
this.liveType = liveType;
}
@Override
public FlowLiveType flowLiveType() {
return this.liveType;
}
@Override
public void setFlowLiveType(FlowLiveType liveType) {
this.liveType = liveType;
}
@Override
public String toString() {
return toStringHelper(this)
.add("entry", super.toString())
.add("type", liveType)
.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.net.flow;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Default flow entry class with FlowLiveType value, IMMEDIATE_FLOW, SHORT_FLOW, MID_FLOW, LONG_FLOW.
*/
public class DefaultTypedFlowEntry extends DefaultFlowEntry
implements TypedStoredFlowEntry {
private FlowLiveType liveType;
/**
* Creates a typed flow entry from flow rule and its statistics, with default flow live type(IMMEDIATE_FLOW).
*
* @param rule the flow rule
* @param state the flow state
* @param life the flow duration since creation
* @param packets the flow packets count
* @param bytes the flow bytes count
*
*/
public DefaultTypedFlowEntry(FlowRule rule, FlowEntryState state,
long life, long packets, long bytes) {
super(rule, state, life, packets, bytes);
this.liveType = FlowLiveType.IMMEDIATE_FLOW;
}
/**
* Creates a typed flow entry from flow rule, with default flow live type(IMMEDIATE_FLOW).
*
* @param rule the flow rule
*
*/
public DefaultTypedFlowEntry(FlowRule rule) {
super(rule);
this.liveType = FlowLiveType.IMMEDIATE_FLOW;
}
/**
* Creates a typed flow entry from flow entry, with default flow live type(IMMEDIATE_FLOW).
*
* @param fe the flow entry
*
*/
public DefaultTypedFlowEntry(FlowEntry fe) {
super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
this.liveType = FlowLiveType.IMMEDIATE_FLOW;
}
/**
* Creates a typed flow entry from flow rule and flow live type.
*
* @param rule the flow rule
* @param liveType the flow live type
*
*/
public DefaultTypedFlowEntry(FlowRule rule, FlowLiveType liveType) {
super(rule);
this.liveType = liveType;
}
/**
* Creates a typed flow entry from flow entry and flow live type.
*
* @param fe the flow rule
* @param liveType the flow live type
*
*/
public DefaultTypedFlowEntry(FlowEntry fe, FlowLiveType liveType) {
super(fe, fe.state(), fe.life(), fe.packets(), fe.bytes());
this.liveType = liveType;
}
/**
* Creates a typed flow entry from flow rule, error code and flow live type.
*
* @param rule the flow rule
* @param errType the flow error type
* @param errCode the flow error code
* @param liveType the flow live type
*
*/
public DefaultTypedFlowEntry(FlowRule rule, int errType, int errCode, FlowLiveType liveType) {
super(rule, errType, errCode);
this.liveType = liveType;
}
@Override
public FlowLiveType flowLiveType() {
return this.liveType;
}
@Override
public void setFlowLiveType(FlowLiveType liveType) {
this.liveType = liveType;
}
@Override
public String toString() {
return toStringHelper(this)
.add("entry", super.toString())
.add("type", liveType)
.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.net.flow;
/**
* Represents a flow live type for a given flow entry.
*/
public interface TypedStoredFlowEntry extends StoredFlowEntry {
enum FlowLiveType {
/**
* Indicates that this rule has been submitted for addition immediately.
* Not necessarily collecting flow stats.
*/
IMMEDIATE_FLOW,
/**
* Indicates that this rule has been submitted for a short time.
* Necessarily collecting flow stats every calAndPollInterval.
*/
SHORT_FLOW,
/**
* Indicates that this rule has been submitted for a mid time.
* Necessarily collecting flow stats every midPollInterval.
*/
MID_FLOW,
/**
* Indicates that this rule has been submitted for a long time.
* Necessarily collecting flow stats every longPollInterval.
*/
LONG_FLOW,
/**
* Indicates that this rule has been submitted for UNKNOWN or ERROR.
* Not necessarily collecting flow stats.
*/
UNKNOWN_FLOW
}
/**
* Gets the flow live type for this entry.
*
* @return flow live type
*/
FlowLiveType flowLiveType();
/**
* Sets the new flow live type for this entry.
* @param liveType new flow live type.
*/
void setFlowLiveType(FlowLiveType liveType);
}
/*
* 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.net.flow;
/**
* Represents a flow live type for a given flow entry.
*/
public interface TypedStoredFlowEntry extends StoredFlowEntry {
enum FlowLiveType {
/**
* Indicates that this rule has been submitted for addition immediately.
* Not necessarily collecting flow stats.
*/
IMMEDIATE_FLOW,
/**
* Indicates that this rule has been submitted for a short time.
* Necessarily collecting flow stats every calAndPollInterval.
*/
SHORT_FLOW,
/**
* Indicates that this rule has been submitted for a mid time.
* Necessarily collecting flow stats every midPollInterval.
*/
MID_FLOW,
/**
* Indicates that this rule has been submitted for a long time.
* Necessarily collecting flow stats every longPollInterval.
*/
LONG_FLOW,
/**
* Indicates that this rule has been submitted for UNKNOWN or ERROR.
* Not necessarily collecting flow stats.
*/
UNKNOWN_FLOW
}
/**
* Gets the flow live type for this entry.
*
* @return flow live type
*/
FlowLiveType flowLiveType();
/**
* Sets the new flow live type for this entry.
* @param liveType new flow live type.
*/
void setFlowLiveType(FlowLiveType liveType);
}
......
/*
* 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.net.statistic;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Device;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.TypedStoredFlowEntry;
import org.onosproject.net.flow.instructions.Instruction;
import java.util.List;
import java.util.Map;
/**
* Service for obtaining individual flow statistic information about device and link in the system.
* Basic statistics are obtained from the StatisticService
*/
public interface FlowStatisticService {
/**
* Obtain the summary load list for the device with the given link.
*
* @param device the Device to query.
* @return map of summary flow entry load
*/
Map<ConnectPoint, SummaryFlowEntryWithLoad> loadSummary(Device device);
/**
* Obtain the summary load for the device with the given link or port.
*
* @param device the Device to query.
* @param pNumber the port number to query.
* @return summary flow entry load
*/
SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber);
/**
* Obtain the set of the flow type and load list for the device with the given link.
*
* @param device the Device to query.
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
* @return map of flow entry load
*/
Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device,
TypedStoredFlowEntry.FlowLiveType liveType,
Instruction.Type instType);
/**
* Obtain the flow type and load list for the device with the given link or port.
*
* @param device the Device to query.
* @param pNumber the port number of the Device to query
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
* @return list of flow entry load
*/
List<TypedFlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber,
TypedStoredFlowEntry.FlowLiveType liveType,
Instruction.Type instType);
/**
* Obtain the set of the flow type and load topn list for the device with the given link.
*
* @param device the Device to query.
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
* @param topn the top number to filter, null means no filtering.
* @return map of flow entry load
*/
Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device,
TypedStoredFlowEntry.FlowLiveType liveType,
Instruction.Type instType,
int topn);
/**
* Obtain the flow type and load topn list for the device with the given link or port.
*
* @param device the Device to query.
* @param pNumber the port number of the Device to query
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
* @param topn topn //FIXME what?
* @return list of flow entry load
*/
List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber,
TypedStoredFlowEntry.FlowLiveType liveType,
Instruction.Type instType,
int topn);
}
/*
* 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.net.statistic;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.Device;
import org.onosproject.net.PortNumber;
import org.onosproject.net.flow.TypedStoredFlowEntry;
import org.onosproject.net.flow.instructions.Instruction;
import java.util.List;
import java.util.Map;
/**
* Service for obtaining individual flow statistic information about device and link in the system.
* Basic statistics are obtained from the StatisticService
*/
public interface FlowStatisticService {
/**
* Obtain the summary load list for the device with the given link.
*
* @param device the Device to query.
* @return map of summary flow entry load
*/
Map<ConnectPoint, SummaryFlowEntryWithLoad> loadSummary(Device device);
/**
* Obtain the summary load for the device with the given link or port.
*
* @param device the Device to query.
* @param pNumber the port number to query.
* @return summary flow entry load
*/
SummaryFlowEntryWithLoad loadSummary(Device device, PortNumber pNumber);
/**
* Obtain the set of the flow type and load list for the device with the given link.
*
* @param device the Device to query.
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
* @return map of flow entry load
*/
Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadAllByType(Device device,
TypedStoredFlowEntry.FlowLiveType liveType,
Instruction.Type instType);
/**
* Obtain the flow type and load list for the device with the given link or port.
*
* @param device the Device to query.
* @param pNumber the port number of the Device to query
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
* @return list of flow entry load
*/
List<TypedFlowEntryWithLoad> loadAllByType(Device device, PortNumber pNumber,
TypedStoredFlowEntry.FlowLiveType liveType,
Instruction.Type instType);
/**
* Obtain the set of the flow type and load topn list for the device with the given link.
*
* @param device the Device to query.
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
* @param topn the top number to filter, null means no filtering.
* @return map of flow entry load
*/
Map<ConnectPoint, List<TypedFlowEntryWithLoad>> loadTopnByType(Device device,
TypedStoredFlowEntry.FlowLiveType liveType,
Instruction.Type instType,
int topn);
/**
* Obtain the flow type and load topn list for the device with the given link or port.
*
* @param device the Device to query.
* @param pNumber the port number of the Device to query
* @param liveType the FlowLiveType to filter, null means no filtering .
* @param instType the InstructionType to filter, null means no filtering.
* @param topn topn //FIXME what?
* @return list of flow entry load
*/
List<TypedFlowEntryWithLoad> loadTopnByType(Device device, PortNumber pNumber,
TypedStoredFlowEntry.FlowLiveType liveType,
Instruction.Type instType,
int topn);
}
......
/*
* 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.net.statistic;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowRule;
import java.util.Set;
/**
* Flow Store to house the computed statistics.
*/
public interface FlowStatisticStore {
/**
* Remove entries associated with this rule.
*
* @param rule {@link org.onosproject.net.flow.FlowRule}
*/
void removeFlowStatistic(FlowRule rule);
/**
* Adds a flow stats observation for a flow rule. The previous flow will be removed.
*
* @param rule a {@link org.onosproject.net.flow.FlowEntry}
*/
void addFlowStatistic(FlowEntry rule);
/**
* Updates a stats observation for a flow rule. The old flow stats will be moved to previous stats.
*
* @param rule a {@link org.onosproject.net.flow.FlowEntry}
*/
void updateFlowStatistic(FlowEntry rule);
/**
* Fetches the current observed flow stats values.
*
* @param connectPoint the port to fetch information for
* @return set of current flow rules
*/
Set<FlowEntry> getCurrentFlowStatistic(ConnectPoint connectPoint);
/**
* Fetches the current observed flow stats values.
*
* @param connectPoint the port to fetch information for
* @return set of current values
*/
Set<FlowEntry> getPreviousFlowStatistic(ConnectPoint connectPoint);
}
/*
* 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.net.statistic;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowRule;
import java.util.Set;
/**
* Flow Store to house the computed statistics.
*/
public interface FlowStatisticStore {
/**
* Remove entries associated with this rule.
*
* @param rule {@link org.onosproject.net.flow.FlowRule}
*/
void removeFlowStatistic(FlowRule rule);
/**
* Adds a flow stats observation for a flow rule. The previous flow will be removed.
*
* @param rule a {@link org.onosproject.net.flow.FlowEntry}
*/
void addFlowStatistic(FlowEntry rule);
/**
* Updates a stats observation for a flow rule. The old flow stats will be moved to previous stats.
*
* @param rule a {@link org.onosproject.net.flow.FlowEntry}
*/
void updateFlowStatistic(FlowEntry rule);
/**
* Fetches the current observed flow stats values.
*
* @param connectPoint the port to fetch information for
* @return set of current flow rules
*/
Set<FlowEntry> getCurrentFlowStatistic(ConnectPoint connectPoint);
/**
* Fetches the current observed flow stats values.
*
* @param connectPoint the port to fetch information for
* @return set of current values
*/
Set<FlowEntry> getPreviousFlowStatistic(ConnectPoint connectPoint);
}
......
/*
* 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.net.statistic;
import org.onosproject.net.ConnectPoint;
/**
* Summary Load classified by flow live type.
*/
public class SummaryFlowEntryWithLoad {
private ConnectPoint cp;
private Load totalLoad;
private Load immediateLoad;
private Load shortLoad;
private Load midLoad;
private Load longLoad;
private Load unknownLoad;
/**
* Creates a new summary flow entry having load for the given connect point and total load.
*
* @param cp connect point
* @param totalLoad total load
*/
public SummaryFlowEntryWithLoad(ConnectPoint cp, Load totalLoad) {
this.cp = cp;
this.totalLoad = totalLoad;
this.immediateLoad = new DefaultLoad();
this.shortLoad = new DefaultLoad();
this.midLoad = new DefaultLoad();
this.longLoad = new DefaultLoad();
this.unknownLoad = new DefaultLoad();
}
/**
* Creates a new summary flow entry having load for the given connect point
* and total, immediate, short, mid, and long load.
*
* @param cp connect point
* @param totalLoad total load
* @param immediateLoad immediate load
* @param shortLoad short load
* @param midLoad mid load
* @param longLoad long load
*/
public SummaryFlowEntryWithLoad(ConnectPoint cp,
Load totalLoad, Load immediateLoad, Load shortLoad, Load midLoad, Load longLoad) {
this.cp = cp;
this.totalLoad = totalLoad;
this.immediateLoad = immediateLoad;
this.shortLoad = shortLoad;
this.midLoad = midLoad;
this.longLoad = longLoad;
this.unknownLoad = new DefaultLoad();
}
/**
* Creates a new summary flow entry having load for the given connect point
* and total, immediate, short, mid, long, and unknown load.
*
* @param cp connect point
* @param totalLoad total load
* @param immediateLoad immediate load
* @param shortLoad short load
* @param midLoad mid load
* @param longLoad long load
* @param unknownLoad long load
*/
public SummaryFlowEntryWithLoad(ConnectPoint cp,
Load totalLoad, Load immediateLoad,
Load shortLoad, Load midLoad, Load longLoad, Load unknownLoad) {
this.cp = cp;
this.totalLoad = totalLoad;
this.immediateLoad = immediateLoad;
this.shortLoad = shortLoad;
this.midLoad = midLoad;
this.longLoad = longLoad;
this.unknownLoad = unknownLoad;
}
/**
* Returns connect point.
*
* @return connect point
*/
public ConnectPoint connectPoint() {
return cp;
}
/**
* Returns total load of connect point.
*
* @return total load
*/
public Load totalLoad() {
return totalLoad;
}
/**
* Returns immediate load of connect point.
*
* @return immediate load
*/
public Load immediateLoad() {
return immediateLoad;
}
/**
* Returns short load of connect point.
*
* @return short load
*/
public Load shortLoad() {
return shortLoad;
}
/**
* Returns mid load of connect point.
*
* @return mid load
*/
public Load midLoad() {
return midLoad;
}
/**
* Returns long load of connect point.
*
* @return long load
*/
public Load longLoad() {
return longLoad;
}
/**
* Returns unknown load of connect point.
*
* @return unknown load
*/
public Load unknownLoad() {
return unknownLoad;
}
}
/*
* 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.net.statistic;
import org.onosproject.net.ConnectPoint;
/**
* Summary Load classified by flow live type.
*/
public class SummaryFlowEntryWithLoad {
private ConnectPoint cp;
private Load totalLoad;
private Load immediateLoad;
private Load shortLoad;
private Load midLoad;
private Load longLoad;
private Load unknownLoad;
/**
* Creates a new summary flow entry having load for the given connect point and total load.
*
* @param cp connect point
* @param totalLoad total load
*/
public SummaryFlowEntryWithLoad(ConnectPoint cp, Load totalLoad) {
this.cp = cp;
this.totalLoad = totalLoad;
this.immediateLoad = new DefaultLoad();
this.shortLoad = new DefaultLoad();
this.midLoad = new DefaultLoad();
this.longLoad = new DefaultLoad();
this.unknownLoad = new DefaultLoad();
}
/**
* Creates a new summary flow entry having load for the given connect point
* and total, immediate, short, mid, and long load.
*
* @param cp connect point
* @param totalLoad total load
* @param immediateLoad immediate load
* @param shortLoad short load
* @param midLoad mid load
* @param longLoad long load
*/
public SummaryFlowEntryWithLoad(ConnectPoint cp,
Load totalLoad, Load immediateLoad, Load shortLoad, Load midLoad, Load longLoad) {
this.cp = cp;
this.totalLoad = totalLoad;
this.immediateLoad = immediateLoad;
this.shortLoad = shortLoad;
this.midLoad = midLoad;
this.longLoad = longLoad;
this.unknownLoad = new DefaultLoad();
}
/**
* Creates a new summary flow entry having load for the given connect point
* and total, immediate, short, mid, long, and unknown load.
*
* @param cp connect point
* @param totalLoad total load
* @param immediateLoad immediate load
* @param shortLoad short load
* @param midLoad mid load
* @param longLoad long load
* @param unknownLoad long load
*/
public SummaryFlowEntryWithLoad(ConnectPoint cp,
Load totalLoad, Load immediateLoad,
Load shortLoad, Load midLoad, Load longLoad, Load unknownLoad) {
this.cp = cp;
this.totalLoad = totalLoad;
this.immediateLoad = immediateLoad;
this.shortLoad = shortLoad;
this.midLoad = midLoad;
this.longLoad = longLoad;
this.unknownLoad = unknownLoad;
}
/**
* Returns connect point.
*
* @return connect point
*/
public ConnectPoint connectPoint() {
return cp;
}
/**
* Returns total load of connect point.
*
* @return total load
*/
public Load totalLoad() {
return totalLoad;
}
/**
* Returns immediate load of connect point.
*
* @return immediate load
*/
public Load immediateLoad() {
return immediateLoad;
}
/**
* Returns short load of connect point.
*
* @return short load
*/
public Load shortLoad() {
return shortLoad;
}
/**
* Returns mid load of connect point.
*
* @return mid load
*/
public Load midLoad() {
return midLoad;
}
/**
* Returns long load of connect point.
*
* @return long load
*/
public Load longLoad() {
return longLoad;
}
/**
* Returns unknown load of connect point.
*
* @return unknown load
*/
public Load unknownLoad() {
return unknownLoad;
}
}
......
/*
* 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.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4;
import org.onosproject.bgpio.types.BgpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Abstraction to provide the version for BGP.
*/
public final class BgpFactories {
protected static final Logger log = LoggerFactory.getLogger(BgpFactories.class);
private static final GenericReader GENERIC_READER = new GenericReader();
private BgpFactories() {
}
/**
* Returns the instance of BGP Version.
*
* @param version BGP version
* @return BGP version
*/
public static BgpFactory getFactory(BgpVersion version) {
switch (version) {
case BGP_4:
return BgpFactoryVer4.INSTANCE;
default:
throw new IllegalArgumentException("[BgpFactory:]Unknown version: " + version);
}
}
/**
* Reader class for reading BGP messages from channel buffer.
*
*/
private static class GenericReader implements BgpMessageReader<BgpMessage> {
@Override
public BgpMessage readFrom(ChannelBuffer bb, BgpHeader bgpHeader)
throws BgpParseException {
BgpFactory factory;
if (!bb.readable()) {
log.error("Empty message received");
throw new BgpParseException("Empty message received");
}
// TODO: Currently only BGP version 4 is supported
factory = org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4.INSTANCE;
return factory.getReader().readFrom(bb, bgpHeader);
}
}
/**
* Returns BGP messsage generic reader.
*
* @return bgp message generic reader
*/
public static BgpMessageReader<BgpMessage> getGenericReader() {
return GENERIC_READER;
}
}
/*
* 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.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4;
import org.onosproject.bgpio.types.BgpHeader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Abstraction to provide the version for BGP.
*/
public final class BgpFactories {
protected static final Logger log = LoggerFactory.getLogger(BgpFactories.class);
private static final GenericReader GENERIC_READER = new GenericReader();
private BgpFactories() {
}
/**
* Returns the instance of BGP Version.
*
* @param version BGP version
* @return BGP version
*/
public static BgpFactory getFactory(BgpVersion version) {
switch (version) {
case BGP_4:
return BgpFactoryVer4.INSTANCE;
default:
throw new IllegalArgumentException("[BgpFactory:]Unknown version: " + version);
}
}
/**
* Reader class for reading BGP messages from channel buffer.
*
*/
private static class GenericReader implements BgpMessageReader<BgpMessage> {
@Override
public BgpMessage readFrom(ChannelBuffer bb, BgpHeader bgpHeader)
throws BgpParseException {
BgpFactory factory;
if (!bb.readable()) {
log.error("Empty message received");
throw new BgpParseException("Empty message received");
}
// TODO: Currently only BGP version 4 is supported
factory = org.onosproject.bgpio.protocol.ver4.BgpFactoryVer4.INSTANCE;
return factory.getReader().readFrom(bb, bgpHeader);
}
}
/**
* Returns BGP messsage generic reader.
*
* @return bgp message generic reader
*/
public static BgpMessageReader<BgpMessage> getGenericReader() {
return GENERIC_READER;
}
}
......
/*
* 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.bgpio.types;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides FourOctetAsNumCapabilityTlv Capability Tlv.
*/
public class FourOctetAsNumCapabilityTlv implements BgpValueType {
/**
* support to indicate its support for four-octet AS numbers -CAPABILITY TLV format.
*/
protected static final Logger log = LoggerFactory
.getLogger(FourOctetAsNumCapabilityTlv.class);
public static final byte TYPE = 65;
public static final byte LENGTH = 4;
private final int rawValue;
/**
* constructor to initialize rawValue.
* @param rawValue FourOctetAsNumCapabilityTlv
*/
public FourOctetAsNumCapabilityTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* constructor to initialize raw.
* @param raw AS number
* @return object of FourOctetAsNumCapabilityTlv
*/
public static FourOctetAsNumCapabilityTlv of(final int raw) {
return new FourOctetAsNumCapabilityTlv(raw);
}
/**
* Returns value of TLV.
* @return int value of rawValue
*/
public int getInt() {
return rawValue;
}
@Override
public short getType() {
return TYPE;
}
@Override
public int hashCode() {
return Objects.hash(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof FourOctetAsNumCapabilityTlv) {
FourOctetAsNumCapabilityTlv other = (FourOctetAsNumCapabilityTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer cb) {
int iLenStartIndex = cb.writerIndex();
cb.writeByte(TYPE);
cb.writeByte(LENGTH);
cb.writeInt(rawValue);
return cb.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of FourOctetAsNumCapabilityTlv.
* @param cb type of channel buffer
* @return object of FourOctetAsNumCapabilityTlv
*/
public static FourOctetAsNumCapabilityTlv read(ChannelBuffer cb) {
return FourOctetAsNumCapabilityTlv.of(cb.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("Type", TYPE)
.add("Length", LENGTH)
.add("Value", rawValue).toString();
}
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
return 0;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgpio.types;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
/**
* Provides FourOctetAsNumCapabilityTlv Capability Tlv.
*/
public class FourOctetAsNumCapabilityTlv implements BgpValueType {
/**
* support to indicate its support for four-octet AS numbers -CAPABILITY TLV format.
*/
protected static final Logger log = LoggerFactory
.getLogger(FourOctetAsNumCapabilityTlv.class);
public static final byte TYPE = 65;
public static final byte LENGTH = 4;
private final int rawValue;
/**
* constructor to initialize rawValue.
* @param rawValue FourOctetAsNumCapabilityTlv
*/
public FourOctetAsNumCapabilityTlv(int rawValue) {
this.rawValue = rawValue;
}
/**
* constructor to initialize raw.
* @param raw AS number
* @return object of FourOctetAsNumCapabilityTlv
*/
public static FourOctetAsNumCapabilityTlv of(final int raw) {
return new FourOctetAsNumCapabilityTlv(raw);
}
/**
* Returns value of TLV.
* @return int value of rawValue
*/
public int getInt() {
return rawValue;
}
@Override
public short getType() {
return TYPE;
}
@Override
public int hashCode() {
return Objects.hash(rawValue);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof FourOctetAsNumCapabilityTlv) {
FourOctetAsNumCapabilityTlv other = (FourOctetAsNumCapabilityTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
}
@Override
public int write(ChannelBuffer cb) {
int iLenStartIndex = cb.writerIndex();
cb.writeByte(TYPE);
cb.writeByte(LENGTH);
cb.writeInt(rawValue);
return cb.writerIndex() - iLenStartIndex;
}
/**
* Reads the channel buffer and returns object of FourOctetAsNumCapabilityTlv.
* @param cb type of channel buffer
* @return object of FourOctetAsNumCapabilityTlv
*/
public static FourOctetAsNumCapabilityTlv read(ChannelBuffer cb) {
return FourOctetAsNumCapabilityTlv.of(cb.readInt());
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("Type", TYPE)
.add("Length", LENGTH)
.add("Value", rawValue).toString();
}
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
return 0;
}
}
......
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgpio.types;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Objects;
/**
* Provides MultiProtocolExtnCapabilityTlv.
*/
public class MultiProtocolExtnCapabilityTlv implements BgpValueType {
/*
0 7 15 23 31
+-------+-------+-------+-------+
| AFI | Res | SAFI |
+-------+-------+-------+-------+
Multiprotocol Extensions CAPABILITY TLV format
REFERENCE : RFC 4760
*/
protected static final Logger log = LoggerFactory
.getLogger(MultiProtocolExtnCapabilityTlv.class);
public static final byte TYPE = 1;
public static final byte LENGTH = 4;
private final short afi;
private final byte res;
private final byte safi;
/**
* Constructor to initialize variables.
* @param afi Address Family Identifiers
* @param res reserved field
* @param safi Subsequent Address Family Identifier
*/
public MultiProtocolExtnCapabilityTlv(short afi, byte res, byte safi) {
this.afi = afi;
this.res = res;
this.safi = safi;
}
/**
* Returns object of MultiProtocolExtnCapabilityTlv.
* @param afi Address Family Identifiers
* @param res reserved field
* @param safi Subsequent Address Family Identifier
* @return object of MultiProtocolExtnCapabilityTlv
*/
public static MultiProtocolExtnCapabilityTlv of(short afi, byte res,
byte safi) {
return new MultiProtocolExtnCapabilityTlv(afi, res, safi);
}
/**
* Returns afi Address Family Identifiers value.
* @return afi Address Family Identifiers value
*/
public short getAfi() {
return afi;
}
/**
* Returns res reserved field value.
* @return res reserved field value
*/
public byte getRes() {
return res;
}
/**
* Returns safi Subsequent Address Family Identifier value.
* @return safi Subsequent Address Family Identifier value
*/
public byte getSafi() {
return safi;
}
@Override
public short getType() {
return TYPE;
}
@Override
public int hashCode() {
return Objects.hash(afi, res, safi);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof MultiProtocolExtnCapabilityTlv) {
MultiProtocolExtnCapabilityTlv other = (MultiProtocolExtnCapabilityTlv) obj;
return Objects.equals(this.afi, other.afi)
&& Objects.equals(this.res, other.res)
&& Objects.equals(this.safi, other.safi);
}
return false;
}
@Override
public int write(ChannelBuffer cb) {
int iLenStartIndex = cb.writerIndex();
cb.writeByte(TYPE);
cb.writeByte(LENGTH);
// write afi
cb.writeShort(afi);
// write res
cb.writeByte(res);
// write safi
cb.writeByte(safi);
return cb.writerIndex() - iLenStartIndex;
}
/**
* Reads from channel buffer and returns object of MultiprotocolCapabilityTlv.
* @param cb of type channel buffer
* @return object of MultiProtocolExtnCapabilityTlv
*/
public static BgpValueType read(ChannelBuffer cb) {
short afi = cb.readShort();
byte res = cb.readByte();
byte safi = cb.readByte();
return new MultiProtocolExtnCapabilityTlv(afi, res, safi);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("Type", TYPE)
.add("Length", LENGTH)
.add("AFI", afi)
.add("Reserved", res)
.add("SAFI", safi).toString();
}
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
return 0;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgpio.types;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Objects;
/**
* Provides MultiProtocolExtnCapabilityTlv.
*/
public class MultiProtocolExtnCapabilityTlv implements BgpValueType {
/*
0 7 15 23 31
+-------+-------+-------+-------+
| AFI | Res | SAFI |
+-------+-------+-------+-------+
Multiprotocol Extensions CAPABILITY TLV format
REFERENCE : RFC 4760
*/
protected static final Logger log = LoggerFactory
.getLogger(MultiProtocolExtnCapabilityTlv.class);
public static final byte TYPE = 1;
public static final byte LENGTH = 4;
private final short afi;
private final byte res;
private final byte safi;
/**
* Constructor to initialize variables.
* @param afi Address Family Identifiers
* @param res reserved field
* @param safi Subsequent Address Family Identifier
*/
public MultiProtocolExtnCapabilityTlv(short afi, byte res, byte safi) {
this.afi = afi;
this.res = res;
this.safi = safi;
}
/**
* Returns object of MultiProtocolExtnCapabilityTlv.
* @param afi Address Family Identifiers
* @param res reserved field
* @param safi Subsequent Address Family Identifier
* @return object of MultiProtocolExtnCapabilityTlv
*/
public static MultiProtocolExtnCapabilityTlv of(short afi, byte res,
byte safi) {
return new MultiProtocolExtnCapabilityTlv(afi, res, safi);
}
/**
* Returns afi Address Family Identifiers value.
* @return afi Address Family Identifiers value
*/
public short getAfi() {
return afi;
}
/**
* Returns res reserved field value.
* @return res reserved field value
*/
public byte getRes() {
return res;
}
/**
* Returns safi Subsequent Address Family Identifier value.
* @return safi Subsequent Address Family Identifier value
*/
public byte getSafi() {
return safi;
}
@Override
public short getType() {
return TYPE;
}
@Override
public int hashCode() {
return Objects.hash(afi, res, safi);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof MultiProtocolExtnCapabilityTlv) {
MultiProtocolExtnCapabilityTlv other = (MultiProtocolExtnCapabilityTlv) obj;
return Objects.equals(this.afi, other.afi)
&& Objects.equals(this.res, other.res)
&& Objects.equals(this.safi, other.safi);
}
return false;
}
@Override
public int write(ChannelBuffer cb) {
int iLenStartIndex = cb.writerIndex();
cb.writeByte(TYPE);
cb.writeByte(LENGTH);
// write afi
cb.writeShort(afi);
// write res
cb.writeByte(res);
// write safi
cb.writeByte(safi);
return cb.writerIndex() - iLenStartIndex;
}
/**
* Reads from channel buffer and returns object of MultiprotocolCapabilityTlv.
* @param cb of type channel buffer
* @return object of MultiProtocolExtnCapabilityTlv
*/
public static BgpValueType read(ChannelBuffer cb) {
short afi = cb.readShort();
byte res = cb.readByte();
byte safi = cb.readByte();
return new MultiProtocolExtnCapabilityTlv(afi, res, safi);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("Type", TYPE)
.add("Length", LENGTH)
.add("AFI", afi)
.add("Reserved", res)
.add("SAFI", safi).toString();
}
@Override
public int compareTo(Object o) {
// TODO Auto-generated method stub
return 0;
}
}
......