Jonathan Hart
Committed by Gerrit Code Review

Enforce naming convention regarding abbreviations

Change-Id: Ic81038d3869268a55624ccbbf66048545158b0da
Showing 121 changed files with 843 additions and 862 deletions
......@@ -60,7 +60,7 @@ public class DefaultIpDeviceDescription extends AbstractDescription
* @param annotations Annotations to use.
*/
public DefaultIpDeviceDescription(IpDeviceDescription base, SparseAnnotations... annotations) {
this(base.deviceURI(), base.type(), base.deviceIdentifier(),
this(base.deviceUri(), base.type(), base.deviceIdentifier(),
base.deviceTed(), annotations);
}
......@@ -71,12 +71,12 @@ public class DefaultIpDeviceDescription extends AbstractDescription
* @param annotations Annotations to use.
*/
public DefaultIpDeviceDescription(IpDeviceDescription base, Type type, SparseAnnotations... annotations) {
this(base.deviceURI(), type, base.deviceIdentifier(),
this(base.deviceUri(), type, base.deviceIdentifier(),
base.deviceTed(), annotations);
}
@Override
public URI deviceURI() {
public URI deviceUri() {
return uri;
}
......
......@@ -35,7 +35,7 @@ public interface IpDeviceDescription extends Description {
*
* @return provider specific URI for the ip device
*/
URI deviceURI();
URI deviceUri();
/**
* Returns the type of the ip device. For ex: Psuedo or actual
......
......@@ -25,13 +25,13 @@ import java.util.HashMap;
public final class OpenstackExternalGateway {
private String networkId;
private boolean enablePNAT;
private boolean enablePnat;
private HashMap<String, Ip4Address> externalFixedIps;
private OpenstackExternalGateway(String networkId, boolean enablePNAT,
private OpenstackExternalGateway(String networkId, boolean enablePnat,
HashMap externalFixedIps) {
this.networkId = networkId;
this.enablePNAT = enablePNAT;
this.enablePnat = enablePnat;
this.externalFixedIps = externalFixedIps;
}
......@@ -49,8 +49,8 @@ public final class OpenstackExternalGateway {
*
* @return PNAT status
*/
public boolean isEnablePNAT() {
return enablePNAT;
public boolean isEnablePnat() {
return enablePnat;
}
/**
......@@ -58,11 +58,11 @@ public final class OpenstackExternalGateway {
*/
public static final class Builder {
private String networkId;
private boolean enablePNAT;
private HashMap<String, Ip4Address> externalFixedIPs;
private boolean enablePnat;
private HashMap<String, Ip4Address> externalFixedIps;
Builder() {
externalFixedIPs = new HashMap<>();
externalFixedIps = new HashMap<>();
}
/**
......@@ -79,11 +79,11 @@ public final class OpenstackExternalGateway {
/**
* Sets whether PNAT status is enabled or not.
*
* @param enablePNAT true if PNAT status is enabled, false otherwise
* @param enablePnat true if PNAT status is enabled, false otherwise
* @return Builder object
*/
public Builder enablePNAT(boolean enablePNAT) {
this.enablePNAT = enablePNAT;
public Builder enablePnat(boolean enablePnat) {
this.enablePnat = enablePnat;
return this;
}
......@@ -93,8 +93,8 @@ public final class OpenstackExternalGateway {
* @param externalFixedIPs External fixed IP information
* @return Builder object
*/
public Builder externalFixedIPs(HashMap<String, Ip4Address> externalFixedIPs) {
this.externalFixedIPs.putAll(externalFixedIPs);
public Builder externalFixedIps(HashMap<String, Ip4Address> externalFixedIPs) {
this.externalFixedIps.putAll(externalFixedIPs);
return this;
}
......@@ -104,7 +104,7 @@ public final class OpenstackExternalGateway {
* @return OpenstackExternalGateway object
*/
public OpenstackExternalGateway build() {
return new OpenstackExternalGateway(networkId, enablePNAT, externalFixedIPs);
return new OpenstackExternalGateway(networkId, enablePnat, externalFixedIps);
}
}
......
......@@ -20,10 +20,10 @@ import org.onosproject.net.packet.PacketContext;
/**
* Handle ICMP packet processing for Managing Flow Rules In Openstack Nodes.
*/
public class OpenstackICMPHandler implements Runnable {
public class OpenstackIcmpHandler implements Runnable {
volatile PacketContext context;
OpenstackICMPHandler(PacketContext context) {
OpenstackIcmpHandler(PacketContext context) {
this.context = context;
}
......
......@@ -20,10 +20,10 @@ import org.onosproject.net.packet.PacketContext;
/**
* Handle NAT packet processing for Managing Flow Rules In Openstack Nodes.
*/
public class OpenstackPNATHandler implements Runnable {
public class OpenstackPnatHandler implements Runnable {
volatile PacketContext context;
OpenstackPNATHandler(PacketContext context) {
OpenstackPnatHandler(PacketContext context) {
this.context = context;
}
......
......@@ -57,8 +57,8 @@ public class OpenstackRoutingManager implements OpenstackRoutingService {
protected DriverService driverService;
private ApplicationId appId;
private OpenstackICMPHandler icmpHandler;
private OpenstackPNATHandler natHandler;
private OpenstackIcmpHandler icmpHandler;
private OpenstackPnatHandler natHandler;
private OpenstackFloatingIPHandler floatingIPHandler;
private OpenstackRoutingRulePopulator openstackRoutingRulePopulator;
......@@ -144,10 +144,10 @@ public class OpenstackRoutingManager implements OpenstackRoutingService {
IPv4 iPacket = (IPv4) ethernet.getPayload();
switch (iPacket.getProtocol()) {
case IPv4.PROTOCOL_ICMP:
icmpEventExcutorService.execute(new OpenstackICMPHandler(context));
icmpEventExcutorService.execute(new OpenstackIcmpHandler(context));
break;
default:
l3EventExcutorService.execute(new OpenstackPNATHandler(context));
l3EventExcutorService.execute(new OpenstackPnatHandler(context));
break;
}
......
......@@ -67,7 +67,7 @@ public final class OpenstackPortInfo {
return this;
}
public Builder setVNI(long vni) {
public Builder setVni(long vni) {
this.vni = checkNotNull(vni, "vni cannot be null");
return this;
}
......
......@@ -327,7 +327,7 @@ public class OpenstackSwitchingManager implements OpenstackSwitchingService {
OpenstackPortInfo.Builder portBuilder = OpenstackPortInfo.builder()
.setDeviceId(deviceId)
.setHostIp((Ip4Address) openstackPort.fixedIps().values().stream().findFirst().orElse(null))
.setVNI(vni);
.setVni(vni);
openstackPortInfoMap.putIfAbsent(port.annotations().value(PORTNAME),
portBuilder.build());
......
......@@ -26,5 +26,5 @@ public interface PcepLinkListener {
*
* @param link pcep link
*/
void handlePCEPlink(PcepLink link);
void handlePceplink(PcepLink link);
}
......
......@@ -69,7 +69,7 @@ public interface PcepTunnel extends PcepOperator {
DIAMOND
}
enum PATHTYPE {
enum PathType {
/**
* Indicates path is the preferred path.
......@@ -179,7 +179,7 @@ public interface PcepTunnel extends PcepOperator {
*
* @return the type of a path, the preferred or alternate.
*/
PATHTYPE getPathType();
PathType getPathType();
/**
* Get the under lay tunnel id of VLAN tunnel.
......
......@@ -26,7 +26,7 @@ public interface PcepTunnelListener {
*
* @param tunnel a pceptunnel.
*/
void handlePCEPTunnel(PcepTunnel tunnel);
void handlePcepTunnel(PcepTunnel tunnel);
/**
* Notify that get a tunnel statistic data from the network.
......
......@@ -28,24 +28,24 @@ public interface ServiceFunctionForwarderService {
* Install Forwarding rule.
*
* @param portChain port-chain
* @param nshSPI nsh spi
* @param nshSpi nsh spi
*/
void installForwardingRule(PortChain portChain, NshServicePathId nshSPI);
void installForwardingRule(PortChain portChain, NshServicePathId nshSpi);
/**
* Uninstall Forwarding rule.
*
* @param portChain port-chain
* @param nshSPI nsh spi
* @param nshSpi nsh spi
*/
void unInstallForwardingRule(PortChain portChain, NshServicePathId nshSPI);
void unInstallForwardingRule(PortChain portChain, NshServicePathId nshSpi);
/**
* Prepare forwarding object for Service Function.
*
* @param portChain port-chain
* @param nshSPI nsh spi
* @param nshSpi nsh spi
* @param type forwarding objective operation type
*/
void prepareServiceFunctionForwarder(PortChain portChain, NshServicePathId nshSPI, Objective.Operation type);
void prepareServiceFunctionForwarder(PortChain portChain, NshServicePathId nshSpi, Objective.Operation type);
}
......
......@@ -15,58 +15,56 @@
*/
package org.onosproject.sfc.forwarder.impl;
import static org.slf4j.LoggerFactory.getLogger;
import static org.onosproject.net.flow.criteria.ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_SPI;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List;
import java.util.ListIterator;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onlab.osgi.DefaultServiceDirectory;
import org.onlab.osgi.ServiceDirectory;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.behaviour.ExtensionSelectorResolver;
import org.onosproject.net.DeviceId;
import org.onosproject.net.Host;
import org.onosproject.net.HostId;
import org.onosproject.net.NshServicePathId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.behaviour.ExtensionSelectorResolver;
import org.onosproject.net.driver.DriverHandler;
import org.onosproject.net.driver.DriverService;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.criteria.ExtensionSelector;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.flow.criteria.ExtensionSelector;
import org.onosproject.net.flowobjective.DefaultForwardingObjective;
import org.onosproject.net.flowobjective.FlowObjectiveService;
import org.onosproject.net.flowobjective.ForwardingObjective;
import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
import org.onosproject.net.flowobjective.Objective;
import org.onosproject.net.host.HostService;
import org.onosproject.net.flowobjective.ForwardingObjective.Flag;
import org.onosproject.vtnrsc.VirtualPortId;
import org.onosproject.vtnrsc.service.VtnRscService;
import org.onosproject.sfc.forwarder.ServiceFunctionForwarderService;
import org.onosproject.vtnrsc.PortChain;
import org.onosproject.vtnrsc.PortPair;
import org.onosproject.vtnrsc.PortPairGroup;
import org.onosproject.vtnrsc.PortPairGroupId;
import org.onosproject.vtnrsc.PortPairId;
import org.onosproject.vtnrsc.virtualport.VirtualPortService;
import org.onosproject.vtnrsc.portpair.PortPairService;
import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
import org.onosproject.vtnrsc.VirtualPortId;
import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
import org.onosproject.vtnrsc.portchain.PortChainService;
import org.onosproject.sfc.forwarder.ServiceFunctionForwarderService;
import org.onosproject.vtnrsc.portpair.PortPairService;
import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
import org.onosproject.vtnrsc.service.VtnRscService;
import org.onosproject.vtnrsc.virtualport.VirtualPortService;
import org.slf4j.Logger;
import java.util.List;
import java.util.ListIterator;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.flow.criteria.ExtensionSelectorType.ExtensionSelectorTypes.NICIRA_MATCH_NSH_SPI;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provides Service Function Forwarder implementation.
*/
......@@ -119,19 +117,19 @@ public class ServiceFunctionForwarderImpl implements ServiceFunctionForwarderSer
}
@Override
public void installForwardingRule(PortChain portChain, NshServicePathId nshSPI) {
public void installForwardingRule(PortChain portChain, NshServicePathId nshSpi) {
checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
prepareServiceFunctionForwarder(portChain, nshSPI, Objective.Operation.ADD);
prepareServiceFunctionForwarder(portChain, nshSpi, Objective.Operation.ADD);
}
@Override
public void unInstallForwardingRule(PortChain portChain, NshServicePathId nshSPI) {
public void unInstallForwardingRule(PortChain portChain, NshServicePathId nshSpi) {
checkNotNull(portChain, PORT_CHAIN_NOT_NULL);
prepareServiceFunctionForwarder(portChain, nshSPI, Objective.Operation.REMOVE);
prepareServiceFunctionForwarder(portChain, nshSpi, Objective.Operation.REMOVE);
}
@Override
public void prepareServiceFunctionForwarder(PortChain portChain, NshServicePathId nshSPI,
public void prepareServiceFunctionForwarder(PortChain portChain, NshServicePathId nshSpi,
Objective.Operation type) {
// Go through the port pair group list
......@@ -153,7 +151,7 @@ public class ServiceFunctionForwarderImpl implements ServiceFunctionForwarderSer
PortPairGroup nextPortPairGroup = portPairGroupService.getPortPairGroup(portPairGrpId);
// push SFF to OVS
pushServiceFunctionForwarder(currentPortPairGroup, nextPortPairGroup, listGrpIterator, nshSPI, type);
pushServiceFunctionForwarder(currentPortPairGroup, nextPortPairGroup, listGrpIterator, nshSpi, type);
}
/**
......@@ -162,11 +160,11 @@ public class ServiceFunctionForwarderImpl implements ServiceFunctionForwarderSer
* @param currentPortPairGroup current port-pair-group
* @param nextPortPairGroup next port-pair-group
* @param listGrpIterator pointer to port-pair-group list
* @param nshSPI nsh service path id
* @param nshSpi nsh service path id
* @param type objective type
*/
public void pushServiceFunctionForwarder(PortPairGroup currentPortPairGroup, PortPairGroup nextPortPairGroup,
ListIterator<PortPairGroupId> listGrpIterator, NshServicePathId nshSPI, Objective.Operation type) {
ListIterator<PortPairGroupId> listGrpIterator, NshServicePathId nshSpi, Objective.Operation type) {
DeviceId deviceId = null;
DeviceId currentDeviceId = null;
DeviceId nextDeviceId = null;
......@@ -185,13 +183,13 @@ public class ServiceFunctionForwarderImpl implements ServiceFunctionForwarderSer
PortPairId portPairId = portPLIterator.next();
PortPair portPair = portPairService.getPortPair(portPairId);
currentDeviceId = vtnRscService.getSFToSFFMaping(VirtualPortId.portId(portPair.ingress()));
currentDeviceId = vtnRscService.getSfToSffMaping(VirtualPortId.portId(portPair.ingress()));
if (deviceId == null) {
deviceId = currentDeviceId;
}
// pack traffic selector
TrafficSelector.Builder selector = packTrafficSelector(deviceId, portPair, nshSPI);
TrafficSelector.Builder selector = packTrafficSelector(deviceId, portPair, nshSpi);
// Get the required information on port pairs from destination port
// pair group
......@@ -204,7 +202,7 @@ public class ServiceFunctionForwarderImpl implements ServiceFunctionForwarderSer
portPairId = portPLIterator.next();
portPair = portPairService.getPortPair(portPairId);
nextDeviceId = vtnRscService.getSFToSFFMaping(VirtualPortId.portId(portPair.ingress()));
nextDeviceId = vtnRscService.getSfToSffMaping(VirtualPortId.portId(portPair.ingress()));
// pack traffic treatment
TrafficTreatment.Builder treatment = packTrafficTreatment(currentDeviceId, nextDeviceId, portPair);
......@@ -228,10 +226,10 @@ public class ServiceFunctionForwarderImpl implements ServiceFunctionForwarderSer
*
* @param deviceId device id
* @param portPair port-pair
* @param nshSPI nsh spi
* @param nshSpi nsh spi
* @return traffic treatment
*/
public TrafficSelector.Builder packTrafficSelector(DeviceId deviceId, PortPair portPair, NshServicePathId nshSPI) {
public TrafficSelector.Builder packTrafficSelector(DeviceId deviceId, PortPair portPair, NshServicePathId nshSpi) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
MacAddress dstMacAddress = virtualPortService.getPort(VirtualPortId.portId(portPair.egress())).macAddress();
Host host = hostService.getHost(HostId.hostId(dstMacAddress));
......@@ -243,7 +241,7 @@ public class ServiceFunctionForwarderImpl implements ServiceFunctionForwarderSer
ExtensionSelector nspSpiSelector = resolver.getExtensionSelector(NICIRA_MATCH_NSH_SPI.type());
try {
nspSpiSelector.setPropertyValue("nshSpi", nshSPI);
nspSpiSelector.setPropertyValue("nshSpi", nshSpi);
} catch (Exception e) {
log.error("Failed to get extension instruction to set Nsh Spi Id {}", deviceId);
}
......
......@@ -15,20 +15,10 @@
*/
package org.onosproject.sfc.installer.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SI;
import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SPI;
import static org.slf4j.LoggerFactory.getLogger;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import org.apache.felix.scr.annotations.Component;
import org.onlab.osgi.DefaultServiceDirectory;
import org.onlab.osgi.ServiceDirectory;
import org.onlab.packet.Ethernet;
......@@ -41,8 +31,8 @@ import org.onosproject.net.Host;
import org.onosproject.net.HostId;
import org.onosproject.net.NshServicePathId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.behaviour.ExtensionTreatmentResolver;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.driver.DriverHandler;
import org.onosproject.net.driver.DriverService;
import org.onosproject.net.flow.DefaultTrafficSelector;
......@@ -72,9 +62,17 @@ import org.onosproject.vtnrsc.portpair.PortPairService;
import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
import org.onosproject.vtnrsc.service.VtnRscService;
import org.onosproject.vtnrsc.virtualport.VirtualPortService;
import org.slf4j.Logger;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SI;
import static org.onosproject.net.flow.instructions.ExtensionTreatmentType.ExtensionTreatmentTypes.NICIRA_SET_NSH_SPI;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provides flow classifier installer implementation.
*/
......@@ -175,7 +173,7 @@ public class FlowClassifierInstallerImpl implements FlowClassifierInstallerServi
}
@Override
public void prepareFlowClassification(FlowClassifier flowClassifier, PortPair portPair, NshServicePathId nshSPI,
public void prepareFlowClassification(FlowClassifier flowClassifier, PortPair portPair, NshServicePathId nshSpi,
Operation type) {
DeviceId deviceId = null;
// device id if virtual ports are set in flow classifier.
......@@ -187,10 +185,10 @@ public class FlowClassifierInstallerImpl implements FlowClassifierInstallerServi
TpPort nshDstPort = TpPort.tpPort(6633);
if ((flowClassifier.srcPort() != null) && (!flowClassifier.srcPort().portId().isEmpty())) {
deviceIdfromFc = vtnRscService.getSFToSFFMaping(flowClassifier.srcPort());
deviceIdfromFc = vtnRscService.getSfToSffMaping(flowClassifier.srcPort());
deviceId = deviceIdfromFc;
} else {
deviceIdfromPp = vtnRscService.getSFToSFFMaping(VirtualPortId.portId(portPair.ingress()));
deviceIdfromPp = vtnRscService.getSfToSffMaping(VirtualPortId.portId(portPair.ingress()));
srcMacAddress = virtualPortService.getPort(VirtualPortId.portId(portPair.egress())).macAddress();
deviceId = deviceIdfromPp;
}
......@@ -200,7 +198,7 @@ public class FlowClassifierInstallerImpl implements FlowClassifierInstallerServi
// Build traffic treatment.
TrafficTreatment.Builder treatment = packTrafficTreatment(deviceId, srcMacAddress, nshDstPort, deviceIdfromFc,
deviceIdfromPp, nshSPI, flowClassifier);
deviceIdfromPp, nshSpi, flowClassifier);
// Build forwarding objective and send to OVS.
sendServiceFunctionForwarder(selector, treatment, deviceId, type);
......@@ -266,13 +264,13 @@ public class FlowClassifierInstallerImpl implements FlowClassifierInstallerServi
* @param nshDstPort vxlan tunnel port for nsh header
* @param deviceIdfromFc device id if virtual ports are set in flow classifier.
* @param deviceIdfromPp device id if port pair is used to fetch device id.
* @param nshSPI nsh spi
* @param nshSpi nsh spi
* @param flowClassifier flow-classifier
* @return traffic treatment
*/
public TrafficTreatment.Builder packTrafficTreatment(DeviceId deviceId, MacAddress srcMacAddress,
TpPort nshDstPort, DeviceId deviceIdfromFc, DeviceId deviceIdfromPp,
NshServicePathId nshSPI, FlowClassifier flowClassifier) {
NshServicePathId nshSpi, FlowClassifier flowClassifier) {
TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
Host host = hostService.getHost(HostId.hostId(srcMacAddress));
......@@ -295,7 +293,7 @@ public class FlowClassifierInstallerImpl implements FlowClassifierInstallerServi
treatmentBuilder.setUdpDst(nshDstPort);
try {
nspIdTreatment.setPropertyValue("nshSpi", nshSPI);
nspIdTreatment.setPropertyValue("nshSpi", nshSpi);
} catch (Exception e) {
log.error("Failed to get extension instruction to set Nsh Spi Id {}", deviceId);
}
......
......@@ -15,20 +15,14 @@
*/
package org.onosproject.sfc.manager.impl;
import static org.slf4j.LoggerFactory.getLogger;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import org.onlab.util.KryoNamespace;
import org.onlab.util.ItemNotFoundException;
import org.onlab.util.KryoNamespace;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.NshServicePathId;
......@@ -38,22 +32,26 @@ import org.onosproject.sfc.installer.FlowClassifierInstallerService;
import org.onosproject.sfc.installer.impl.FlowClassifierInstallerImpl;
import org.onosproject.sfc.manager.NshSpiIdGenerators;
import org.onosproject.sfc.manager.SfcService;
import org.onosproject.vtnrsc.PortPair;
import org.onosproject.vtnrsc.PortPairId;
import org.onosproject.vtnrsc.PortPairGroup;
import org.onosproject.vtnrsc.PortPairGroupId;
import org.onosproject.vtnrsc.FlowClassifier;
import org.onosproject.vtnrsc.FlowClassifierId;
import org.onosproject.vtnrsc.PortChain;
import org.onosproject.vtnrsc.PortChainId;
import org.onosproject.vtnrsc.PortPair;
import org.onosproject.vtnrsc.PortPairGroup;
import org.onosproject.vtnrsc.PortPairGroupId;
import org.onosproject.vtnrsc.PortPairId;
import org.onosproject.vtnrsc.TenantId;
import org.onosproject.vtnrsc.event.VtnRscEvent;
import org.onosproject.vtnrsc.event.VtnRscEventFeedback;
import org.onosproject.vtnrsc.event.VtnRscListener;
import org.onosproject.vtnrsc.service.VtnRscService;
import org.slf4j.Logger;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provides implementation of SFC Service.
*/
......@@ -192,18 +190,18 @@ public class SfcManager implements SfcService {
@Override
public void onPortChainCreated(PortChain portChain) {
NshServicePathId nshSPI;
NshServicePathId nshSpi;
log.info("onPortChainCreated");
if (nshSpiPortChainMap.containsKey(portChain.portChainId())) {
nshSPI = nshSpiPortChainMap.get(portChain.portChainId());
nshSpi = nshSpiPortChainMap.get(portChain.portChainId());
} else {
nshSPI = NshServicePathId.of(NshSpiIdGenerators.create());
nshSpiPortChainMap.put(portChain.portChainId(), nshSPI);
nshSpi = NshServicePathId.of(NshSpiIdGenerators.create());
nshSpiPortChainMap.put(portChain.portChainId(), nshSpi);
}
// install in OVS.
flowClassifierInstallerService.installFlowClassifier(portChain, nshSPI);
serviceFunctionForwarderService.installForwardingRule(portChain, nshSPI);
flowClassifierInstallerService.installFlowClassifier(portChain, nshSpi);
serviceFunctionForwarderService.installForwardingRule(portChain, nshSpi);
}
@Override
......@@ -213,12 +211,12 @@ public class SfcManager implements SfcService {
throw new ItemNotFoundException("Unable to find NSH SPI");
}
NshServicePathId nshSPI = nshSpiPortChainMap.get(portChain.portChainId());
NshServicePathId nshSpi = nshSpiPortChainMap.get(portChain.portChainId());
// uninstall from OVS.
flowClassifierInstallerService.unInstallFlowClassifier(portChain, nshSPI);
serviceFunctionForwarderService.unInstallForwardingRule(portChain, nshSPI);
flowClassifierInstallerService.unInstallFlowClassifier(portChain, nshSpi);
serviceFunctionForwarderService.unInstallForwardingRule(portChain, nshSpi);
// remove SPI. No longer it will be used.
nshSpiPortChainMap.remove(nshSPI);
nshSpiPortChainMap.remove(nshSpi);
}
}
......
......@@ -51,7 +51,7 @@ public class VtnRscManagerTestImpl implements VtnRscService {
}
@Override
public Iterator<Device> getSFFOfTenant(TenantId tenantId) {
public Iterator<Device> getSffOfTenant(TenantId tenantId) {
return null;
}
......@@ -67,7 +67,7 @@ public class VtnRscManagerTestImpl implements VtnRscService {
}
@Override
public DeviceId getSFToSFFMaping(VirtualPortId portId) {
public DeviceId getSfToSffMaping(VirtualPortId portId) {
return DeviceId.deviceId("www.google.com");
}
......
......@@ -18,7 +18,7 @@ package org.onosproject.vtn.cli;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.commands.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.vtn.manager.impl.VTNManager;
import org.onosproject.vtn.manager.impl.VtnManager;
/**
* Supports for updating the external gateway virtualPort.
......@@ -33,6 +33,6 @@ public class VtnCommand extends AbstractShellCommand {
@Override
protected void execute() {
VTNManager.setExPortName(exPortName);
VtnManager.setExPortName(exPortName);
}
}
......
......@@ -22,7 +22,7 @@ import org.onosproject.vtnrsc.event.VtnRscEventFeedback;
/**
* VTN application that applies configuration and flows to the device.
*/
public interface VTNService {
public interface VtnService {
/**
* Creates a vxlan tunnel and creates the ovs when a ovs controller node is
......
......@@ -82,7 +82,7 @@ import org.onosproject.store.service.LogicalClockService;
import org.onosproject.store.service.Serializer;
import org.onosproject.store.service.StorageService;
import org.onosproject.store.service.Versioned;
import org.onosproject.vtn.manager.VTNService;
import org.onosproject.vtn.manager.VtnService;
import org.onosproject.vtn.table.ArpService;
import org.onosproject.vtn.table.ClassifierService;
import org.onosproject.vtn.table.DnatService;
......@@ -131,7 +131,7 @@ import com.google.common.collect.Sets;
*/
@Component(immediate = true)
@Service
public class VTNManager implements VTNService {
public class VtnManager implements VtnService {
private final Logger log = getLogger(getClass());
private static final String APP_ID = "org.onosproject.app.vtn";
......
......@@ -15,8 +15,6 @@
*/
package org.onosproject.vtnrsc.service;
import java.util.Iterator;
import org.onlab.packet.MacAddress;
import org.onosproject.event.ListenerService;
import org.onosproject.net.Device;
......@@ -29,6 +27,8 @@ import org.onosproject.vtnrsc.VirtualPortId;
import org.onosproject.vtnrsc.event.VtnRscEvent;
import org.onosproject.vtnrsc.event.VtnRscListener;
import java.util.Iterator;
/**
* Service for interacting with the inventory of Vtn resource.
*/
......@@ -55,7 +55,7 @@ public interface VtnRscService extends ListenerService<VtnRscEvent, VtnRscListen
* @param tenantId tenant identifier
* @return iterable collection of Device
*/
Iterator<Device> getSFFOfTenant(TenantId tenantId);
Iterator<Device> getSffOfTenant(TenantId tenantId);
/**
* Returns gateway mac address of the specific host.
......@@ -79,7 +79,7 @@ public interface VtnRscService extends ListenerService<VtnRscEvent, VtnRscListen
* @param portId port identifier
* @return device identifier
*/
DeviceId getSFToSFFMaping(VirtualPortId portId);
DeviceId getSfToSffMaping(VirtualPortId portId);
/**
* Adds specify Device identifier to Service Function Forward OvsMap
......
......@@ -389,7 +389,7 @@ public class VtnRscManager extends AbstractListenerManager<VtnRscEvent, VtnRscLi
}
@Override
public Iterator<Device> getSFFOfTenant(TenantId tenantId) {
public Iterator<Device> getSffOfTenant(TenantId tenantId) {
checkNotNull(tenantId, TENANTID_NOT_NULL);
Set<DeviceId> deviceIdSet = sffOvsMap.get(tenantId);
Set<Device> deviceSet = new HashSet<>();
......@@ -430,7 +430,7 @@ public class VtnRscManager extends AbstractListenerManager<VtnRscEvent, VtnRscLi
}
@Override
public DeviceId getSFToSFFMaping(VirtualPortId portId) {
public DeviceId getSfToSffMaping(VirtualPortId portId) {
checkNotNull(portId, "portId cannot be null");
VirtualPort vmPort = virtualPortService.getPort(portId);
Set<Host> hostSet = hostService.getHostsByMac(vmPort.macAddress());
......
......@@ -44,7 +44,7 @@ public abstract class AbstractDriverLoader {
protected void activate() {
try {
provider = new XmlDriverLoader(getClassLoaderInstance())
.loadDrivers(loadXMLDriversStream(), driverAdminService);
.loadDrivers(loadXmlDriversStream(), driverAdminService);
driverAdminService.registerProvider(provider);
} catch (Exception e) {
log.error("Unable to load default drivers", e);
......@@ -58,7 +58,7 @@ public abstract class AbstractDriverLoader {
log.info("Stopped");
}
protected abstract InputStream loadXMLDriversStream();
protected abstract InputStream loadXmlDriversStream();
protected abstract ClassLoader getClassLoaderInstance();
......
......@@ -247,7 +247,7 @@ public interface Criterion {
}
}
enum TCPFlags {
enum TcpFlags {
/** ECN-nonce concealment protection. */
NS((short) (1 << 0)),
......@@ -270,7 +270,7 @@ public interface Criterion {
private short value;
TCPFlags(short value) {
TcpFlags(short value) {
this.value = value;
}
......
......@@ -138,17 +138,17 @@ public class CriteriaTest {
int tcpFlags1 =
Criterion.TCPFlags.NS.getValue() |
Criterion.TCPFlags.CWR.getValue() |
Criterion.TCPFlags.ECE.getValue() |
Criterion.TCPFlags.URG.getValue() |
Criterion.TCPFlags.ACK.getValue() |
Criterion.TCPFlags.PSH.getValue() |
Criterion.TCPFlags.RST.getValue() |
Criterion.TCPFlags.SYN.getValue();
Criterion.TcpFlags.NS.getValue() |
Criterion.TcpFlags.CWR.getValue() |
Criterion.TcpFlags.ECE.getValue() |
Criterion.TcpFlags.URG.getValue() |
Criterion.TcpFlags.ACK.getValue() |
Criterion.TcpFlags.PSH.getValue() |
Criterion.TcpFlags.RST.getValue() |
Criterion.TcpFlags.SYN.getValue();
int tcpFlags2 = tcpFlags1 |
Criterion.TCPFlags.FIN.getValue();
Criterion.TcpFlags.FIN.getValue();
Criterion matchTcpFlags1 = Criteria.matchTcpFlags(tcpFlags1);
Criterion sameAsmatchTcpFlags1 = Criteria.matchTcpFlags(tcpFlags1);
......
......@@ -30,7 +30,7 @@ public class CienaDriversLoader extends AbstractDriverLoader {
private static final String DRIVERS_XML = "/ciena-drivers.xml";
@Override
protected InputStream loadXMLDriversStream() {
protected InputStream loadXmlDriversStream() {
return getClassLoaderInstance().getResourceAsStream(DRIVERS_XML);
}
......
......@@ -84,7 +84,7 @@ public class PortDiscoveryCienaWaveserverImpl extends AbstractHandlerBehaviour
if (LINESIDE.contains(name)) {
String wsportInfoRequest = SPECIFIC_PORT_PATH + sub.getLong(PORT_ID) +
SPECIFIC_PORT_CONFIG;
ports.add(XmlConfigParser.parseWaveServerCienaOCHPorts(
ports.add(XmlConfigParser.parseWaveServerCienaOchPorts(
sub.getLong(PORT_ID),
toGbps(Long.parseLong(sub.getString(SPEED).replace(GBPS, EMPTY_STRING))),
XmlConfigParser.loadXml(controller.get(deviceId, wsportInfoRequest, XML)),
......
......@@ -33,7 +33,7 @@ public class DefaultDriversLoader extends AbstractDriverLoader implements Defaul
private static final String DRIVERS_XML = "/onos-drivers.xml";
@Override
protected InputStream loadXMLDriversStream() {
protected InputStream loadXmlDriversStream() {
return getClassLoaderInstance().getResourceAsStream(DRIVERS_XML);
}
......
......@@ -149,7 +149,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
IPProtocolCriterion ipProto = (IPProtocolCriterion)
filterForCriterion(filter.conditions(), Criterion.Type.IP_PROTO);
if (ipProto.protocol() == IPv4.PROTOCOL_IGMP) {
provisionIGMP(filter, ethType, ipProto, output);
provisionIgmp(filter, ethType, ipProto, output);
} else {
log.error("OLT can only filter igmp");
fail(filter, ObjectiveError.UNSUPPORTED);
......@@ -377,7 +377,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
}
private void provisionIGMP(FilteringObjective filter, EthTypeCriterion ethType,
private void provisionIgmp(FilteringObjective filter, EthTypeCriterion ethType,
IPProtocolCriterion ipProto,
Instructions.OutputInstruction output) {
TrafficSelector selector = buildSelector(filter.key(), ethType, ipProto);
......
......@@ -134,11 +134,11 @@ public class OpenstackPipeline extends DefaultSingleTablePipeline
}
private void initializePipeline() {
processVNITable(true);
processVniTable(true);
processForwardingTable(true);
}
private void processVNITable(boolean install) {
private void processVniTable(boolean install) {
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder();
......
......@@ -30,7 +30,7 @@ public class FujitsuDriversLoader extends AbstractDriverLoader {
private static final String DRIVERS_XML = "/fujitsu-drivers.xml";
@Override
protected InputStream loadXMLDriversStream() {
protected InputStream loadXmlDriversStream() {
return getClassLoaderInstance().getResourceAsStream(DRIVERS_XML);
}
......
......@@ -30,7 +30,7 @@ public class NetconfDriversLoader extends AbstractDriverLoader {
private static final String DRIVERS_XML = "/netconf-drivers.xml";
@Override
protected InputStream loadXMLDriversStream() {
protected InputStream loadXmlDriversStream() {
return getClassLoaderInstance().getResourceAsStream(DRIVERS_XML);
}
......
......@@ -30,7 +30,7 @@ public class OvsdbDriversLoader extends AbstractDriverLoader {
private static final String DRIVERS_XML = "/ovsdb-drivers.xml";
@Override
protected InputStream loadXMLDriversStream() {
protected InputStream loadXmlDriversStream() {
return getClassLoaderInstance().getResourceAsStream(DRIVERS_XML);
}
......
......@@ -135,7 +135,7 @@ public final class XmlConfigParser {
return cfg.configurationsAt("ws-ports.port-interface");
}
public static PortDescription parseWaveServerCienaOCHPorts(long portNumber, long oduPortSpeed,
public static PortDescription parseWaveServerCienaOchPorts(long portNumber, long oduPortSpeed,
HierarchicalConfiguration config,
SparseAnnotations annotations) {
final List<String> tunableType = Lists.newArrayList("Performance-Optimized", "Accelerated");
......
......@@ -65,9 +65,9 @@ public class XmlConfigParserTest {
@Test
public void controllersConfig() {
InputStream streamOrig = getClass().getResourceAsStream("/testConfig.xml");
InputStream streamCFG = XmlConfigParser.class.getResourceAsStream("/controllers.xml");
InputStream streamCfg = XmlConfigParser.class.getResourceAsStream("/controllers.xml");
String config = XmlConfigParser
.createControllersConfig(XmlConfigParser.loadXml(streamCFG),
.createControllersConfig(XmlConfigParser.loadXml(streamCfg),
XmlConfigParser.loadXml(streamOrig),
"running", "merge", "create",
new ArrayList<>(
......
......@@ -45,14 +45,14 @@ public class DistributedMcastStore extends AbstractStore<McastEvent, McastStoreD
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
private StorageService storageService;
protected ConsistentMap<McastRoute, MulticastData> mcastRIB;
protected ConsistentMap<McastRoute, MulticastData> mcastRib;
protected Map<McastRoute, MulticastData> mcastRoutes;
@Activate
public void activate() {
mcastRIB = storageService.<McastRoute, MulticastData>consistentMapBuilder()
mcastRib = storageService.<McastRoute, MulticastData>consistentMapBuilder()
.withName(MCASTRIB)
.withSerializer(Serializer.using(KryoNamespace.newBuilder().register(
MulticastData.class,
......@@ -65,7 +65,7 @@ public class DistributedMcastStore extends AbstractStore<McastEvent, McastStoreD
.withRelaxedReadConsistency()
.build();
mcastRoutes = mcastRIB.asJavaMap();
mcastRoutes = mcastRib.asJavaMap();
log.info("Started");
......
......@@ -52,6 +52,7 @@
<module>incubator</module>
<module>features</module>
<module>tools/build/conf</module>
<module>tools/package/archetypes</module>
<module>tools/package/branding</module>
<module>tools/package/maven-plugin</module>
......@@ -75,7 +76,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<onos-build-conf.version>1.1</onos-build-conf.version>
<onos-build-conf.version>1.2-SNAPSHOT</onos-build-conf.version>
<netty4.version>4.0.33.Final</netty4.version>
<!-- TODO: replace with final release version when it is out -->
<atomix.version>0.1.0-beta5</atomix.version>
......
......@@ -16,12 +16,12 @@
package org.onosproject.bgp.controller;
import java.util.Map;
import java.util.Set;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpMessage;
import java.util.Map;
import java.util.Set;
/**
* Abstraction of an BGP controller. Serves as a one stop shop for obtaining BGP devices and (un)register listeners on
* bgp events
......@@ -72,7 +72,7 @@ public interface BgpController {
* @param msg the message to process.
* @throws BgpParseException on data processing error
*/
void processBGPPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException;
void processBgpPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException;
/**
* Close all connected BGP peers.
......
......@@ -19,5 +19,5 @@ package org.onosproject.bgpio.protocol;
/**
* Provides Abstraction of IGP RouterID TLV.
*/
public interface IGPRouterID {
public interface IgpRouterId {
}
......
......@@ -27,7 +27,7 @@ import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.IPReachabilityInformationTlv;
import org.onosproject.bgpio.types.OSPFRouteTypeTlv;
import org.onosproject.bgpio.types.OspfRouteTypeTlv;
import org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId;
import org.onosproject.bgpio.util.UnSupportedAttribute;
import org.slf4j.Logger;
......@@ -139,8 +139,8 @@ public class BgpPrefixLSIdentifier implements Comparable<Object> {
}
tempCb = cb.readBytes(length);
switch (type) {
case OSPFRouteTypeTlv.TYPE:
tlv = OSPFRouteTypeTlv.read(tempCb);
case OspfRouteTypeTlv.TYPE:
tlv = OspfRouteTypeTlv.read(tempCb);
break;
case IPReachabilityInformationTlv.TYPE:
tlv = IPReachabilityInformationTlv.read(tempCb, length);
......
......@@ -31,8 +31,8 @@ import org.onosproject.bgpio.types.BgpLSIdentifierTlv;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.IsIsNonPseudonode;
import org.onosproject.bgpio.types.IsIsPseudonode;
import org.onosproject.bgpio.types.OSPFNonPseudonode;
import org.onosproject.bgpio.types.OSPFPseudonode;
import org.onosproject.bgpio.types.OspfNonPseudonode;
import org.onosproject.bgpio.types.OspfPseudonode;
import org.onosproject.bgpio.util.UnSupportedAttribute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -193,9 +193,9 @@ public class NodeDescriptors {
}
} else if (protocolId == OSPF_V2_PROTOCOL_ID || protocolId == OSPF_V3_PROTOCOL_ID) {
if (length == OSPFNONPSEUDONODE_LEN) {
tlv = OSPFNonPseudonode.read(tempCb);
tlv = OspfNonPseudonode.read(tempCb);
} else if (length == OSPFPSEUDONODE_LEN) {
tlv = OSPFPseudonode.read(tempCb);
tlv = OspfPseudonode.read(tempCb);
}
}
break;
......
......@@ -122,11 +122,11 @@ class BgpNotificationMsgVer4 implements BgpNotificationMsg {
private BgpHeader bgpHeader;
private boolean isErrorCodeSet = false;
private boolean isErrorSubCodeSet = false;
private boolean isBGPHeaderSet = false;
private boolean isBgpHeaderSet = false;
@Override
public BgpNotificationMsg build() throws BgpParseException {
BgpHeader bgpHeader = this.isBGPHeaderSet ? this.bgpHeader : DEFAULT_MESSAGE_HEADER;
BgpHeader bgpHeader = this.isBgpHeaderSet ? this.bgpHeader : DEFAULT_MESSAGE_HEADER;
if (!this.isErrorCodeSet) {
throw new BgpParseException("Error code must be present");
}
......
......@@ -15,10 +15,7 @@
*/
package org.onosproject.bgpio.types;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
......@@ -26,7 +23,9 @@ import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Provides Implementation of As4Path BGP Path Attribute.
......@@ -122,7 +121,7 @@ public class As4Path implements BgpValueType {
*
* @return list of ASNum in AS4path Sequence
*/
public List<Integer> as4PathSEQ() {
public List<Integer> as4PathSeq() {
return this.as4pathSeq;
}
......@@ -131,7 +130,7 @@ public class As4Path implements BgpValueType {
*
* @return list of ASNum in AS4path Set
*/
public List<Integer> as4PathSET() {
public List<Integer> as4PathSet() {
return this.as4pathSet;
}
......
......@@ -16,10 +16,7 @@
package org.onosproject.bgpio.types;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
......@@ -27,7 +24,9 @@ import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Provides Implementation of AsPath mandatory BGP Path Attribute.
......@@ -36,7 +35,7 @@ public class AsPath implements BgpValueType {
/**
* Enum to provide AS types.
*/
public enum ASTYPE {
public enum AsType {
AS_SET(1), AS_SEQUENCE(2), AS_CONFED_SEQUENCE(3), AS_CONFED_SET(4);
int value;
......@@ -45,7 +44,7 @@ public class AsPath implements BgpValueType {
*
* @param val AS type
*/
ASTYPE(int val) {
AsType(int val) {
value = val;
}
......
......@@ -15,18 +15,17 @@
*/
package org.onosproject.bgpio.types;
import java.nio.ByteBuffer;
import java.util.Arrays;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.protocol.IGPRouterID;
import org.onosproject.bgpio.protocol.IgpRouterId;
import com.google.common.base.MoreObjects;
import java.nio.ByteBuffer;
import java.util.Arrays;
/**
* Provides Implementation of IsIsNonPseudonode Tlv.
*/
public class IsIsNonPseudonode implements IGPRouterID, BgpValueType {
public class IsIsNonPseudonode implements IgpRouterId, BgpValueType {
public static final short TYPE = 515;
public static final short LENGTH = 6;
......@@ -56,7 +55,7 @@ public class IsIsNonPseudonode implements IGPRouterID, BgpValueType {
*
* @return ISO NodeID
*/
public byte[] getISONodeID() {
public byte[] getIsoNodeId() {
return isoNodeID;
}
......
......@@ -15,19 +15,18 @@
*/
package org.onosproject.bgpio.types;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.protocol.IgpRouterId;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Objects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.protocol.IGPRouterID;
import com.google.common.base.MoreObjects;
/**
* Provides implementation of IsIsPseudonode Tlv.
*/
public class IsIsPseudonode implements IGPRouterID, BgpValueType {
public class IsIsPseudonode implements IgpRouterId, BgpValueType {
public static final short TYPE = 515;
public static final short LENGTH = 7;
......@@ -62,7 +61,7 @@ public class IsIsPseudonode implements IGPRouterID, BgpValueType {
*
* @return ISO NodeID
*/
public byte[] getISONodeID() {
public byte[] getIsoNodeId() {
return isoNodeID;
}
......@@ -71,7 +70,7 @@ public class IsIsPseudonode implements IGPRouterID, BgpValueType {
*
* @return PSN Identifier
*/
public byte getPSNIdentifier() {
public byte getPsnIdentifier() {
return this.psnIdentifier;
}
......
......@@ -15,12 +15,12 @@
*/
package org.onosproject.bgpio.types;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import java.util.Objects;
/**
* Provides MultiProtocolExtnCapabilityTlv.
......@@ -74,7 +74,7 @@ public class MultiProtocolExtnCapabilityTlv implements BgpValueType {
* Returns afi Address Family Identifiers value.
* @return afi Address Family Identifiers value
*/
public short getAFI() {
public short getAfi() {
return afi;
}
......@@ -90,7 +90,7 @@ public class MultiProtocolExtnCapabilityTlv implements BgpValueType {
* Returns safi Subsequent Address Family Identifier value.
* @return safi Subsequent Address Family Identifier value
*/
public byte getSAFI() {
public byte getSafi() {
return safi;
}
......
......@@ -15,14 +15,13 @@
*/
package org.onosproject.bgpio.types;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.util.Constants;
import org.onosproject.bgpio.util.Validation;
import com.google.common.base.MoreObjects;
import java.util.Objects;
/**
* Provides Implementation of mandatory BGP Origin path attribute.
......@@ -32,7 +31,7 @@ public class Origin implements BgpValueType {
/**
* Enum to provide ORIGIN types.
*/
public enum ORIGINTYPE {
public enum OriginType {
IGP(0), EGP(1), INCOMPLETE(2);
int value;
/**
......@@ -40,7 +39,7 @@ public class Origin implements BgpValueType {
*
* @param val ORIGIN type
*/
ORIGINTYPE(int val) {
OriginType(int val) {
value = val;
}
......@@ -84,13 +83,13 @@ public class Origin implements BgpValueType {
*
* @return type of Origin in Enum values
*/
public ORIGINTYPE origin() {
public OriginType origin() {
if (this.origin == 0) {
return ORIGINTYPE.IGP;
return OriginType.IGP;
} else if (this.origin == 1) {
return ORIGINTYPE.EGP;
return OriginType.EGP;
} else {
return ORIGINTYPE.INCOMPLETE;
return OriginType.INCOMPLETE;
}
}
......@@ -118,8 +117,8 @@ public class Origin implements BgpValueType {
byte originValue;
originValue = cb.readByte();
if ((originValue != ORIGINTYPE.INCOMPLETE.value) && (originValue != ORIGINTYPE.IGP.value) &&
(originValue != ORIGINTYPE.EGP.value)) {
if ((originValue != OriginType.INCOMPLETE.value) && (originValue != OriginType.IGP.value) &&
(originValue != OriginType.EGP.value)) {
throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.INVALID_ORIGIN_ATTRIBUTE, data);
}
return new Origin(originValue);
......
......@@ -16,17 +16,16 @@
package org.onosproject.bgpio.types;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.protocol.IGPRouterID;
import org.onosproject.bgpio.protocol.IgpRouterId;
import com.google.common.base.MoreObjects;
import java.util.Objects;
/**
* Provides implementation of OSPFNonPseudonode Tlv.
*/
public class OSPFNonPseudonode implements IGPRouterID, BgpValueType {
public class OspfNonPseudonode implements IgpRouterId, BgpValueType {
public static final short TYPE = 515;
public static final short LENGTH = 4;
......@@ -37,7 +36,7 @@ public class OSPFNonPseudonode implements IGPRouterID, BgpValueType {
*
* @param routerID routerID
*/
public OSPFNonPseudonode(int routerID) {
public OspfNonPseudonode(int routerID) {
this.routerID = routerID;
}
......@@ -47,8 +46,8 @@ public class OSPFNonPseudonode implements IGPRouterID, BgpValueType {
* @param routerID routerID
* @return object of OSPFNonPseudonode
*/
public static OSPFNonPseudonode of(final int routerID) {
return new OSPFNonPseudonode(routerID);
public static OspfNonPseudonode of(final int routerID) {
return new OspfNonPseudonode(routerID);
}
/**
......@@ -71,8 +70,8 @@ public class OSPFNonPseudonode implements IGPRouterID, BgpValueType {
return true;
}
if (obj instanceof OSPFNonPseudonode) {
OSPFNonPseudonode other = (OSPFNonPseudonode) obj;
if (obj instanceof OspfNonPseudonode) {
OspfNonPseudonode other = (OspfNonPseudonode) obj;
return Objects.equals(routerID, other.routerID);
}
return false;
......@@ -93,8 +92,8 @@ public class OSPFNonPseudonode implements IGPRouterID, BgpValueType {
* @param cb ChannelBuffer
* @return object of OSPFNonPseudonode
*/
public static OSPFNonPseudonode read(ChannelBuffer cb) {
return OSPFNonPseudonode.of(cb.readInt());
public static OspfNonPseudonode read(ChannelBuffer cb) {
return OspfNonPseudonode.of(cb.readInt());
}
@Override
......@@ -107,7 +106,7 @@ public class OSPFNonPseudonode implements IGPRouterID, BgpValueType {
if (this.equals(o)) {
return 0;
}
return ((Integer) (this.routerID)).compareTo((Integer) (((OSPFNonPseudonode) o).routerID));
return ((Integer) (this.routerID)).compareTo((Integer) (((OspfNonPseudonode) o).routerID));
}
@Override
......
......@@ -15,18 +15,17 @@
*/
package org.onosproject.bgpio.types;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgpio.protocol.IGPRouterID;
import org.onosproject.bgpio.protocol.IgpRouterId;
import com.google.common.base.MoreObjects;
import java.util.Objects;
/**
* Provides implementation of OSPFPseudonode Tlv.
*/
public class OSPFPseudonode implements IGPRouterID, BgpValueType {
public class OspfPseudonode implements IgpRouterId, BgpValueType {
public static final short TYPE = 515;
public static final short LENGTH = 8;
......@@ -39,7 +38,7 @@ public class OSPFPseudonode implements IGPRouterID, BgpValueType {
* @param routerID routerID
* @param drInterface IPv4 address of the DR's interface
*/
public OSPFPseudonode(int routerID, Ip4Address drInterface) {
public OspfPseudonode(int routerID, Ip4Address drInterface) {
this.routerID = routerID;
this.drInterface = drInterface;
}
......@@ -51,8 +50,8 @@ public class OSPFPseudonode implements IGPRouterID, BgpValueType {
* @param drInterface IPv4 address of the DR's interface
* @return object of OSPFPseudonode
*/
public static OSPFPseudonode of(final int routerID, final Ip4Address drInterface) {
return new OSPFPseudonode(routerID, drInterface);
public static OspfPseudonode of(final int routerID, final Ip4Address drInterface) {
return new OspfPseudonode(routerID, drInterface);
}
/**
......@@ -74,8 +73,8 @@ public class OSPFPseudonode implements IGPRouterID, BgpValueType {
if (this == obj) {
return true;
}
if (obj instanceof OSPFPseudonode) {
OSPFPseudonode other = (OSPFPseudonode) obj;
if (obj instanceof OspfPseudonode) {
OspfPseudonode other = (OspfPseudonode) obj;
return Objects.equals(routerID, other.routerID) && Objects.equals(drInterface, other.drInterface);
}
return false;
......@@ -97,10 +96,10 @@ public class OSPFPseudonode implements IGPRouterID, BgpValueType {
* @param cb ChannelBuffer
* @return object of OSPFPseudonode
*/
public static OSPFPseudonode read(ChannelBuffer cb) {
public static OspfPseudonode read(ChannelBuffer cb) {
int routerID = cb.readInt();
Ip4Address drInterface = Ip4Address.valueOf(cb.readInt());
return OSPFPseudonode.of(routerID, drInterface);
return OspfPseudonode.of(routerID, drInterface);
}
@Override
......@@ -113,9 +112,9 @@ public class OSPFPseudonode implements IGPRouterID, BgpValueType {
if (this.equals(o)) {
return 0;
}
int result = ((Integer) (this.routerID)).compareTo((Integer) (((OSPFPseudonode) o).routerID));
int result = ((Integer) (this.routerID)).compareTo((Integer) (((OspfPseudonode) o).routerID));
if (result != 0) {
return this.drInterface.compareTo(((OSPFPseudonode) o).drInterface);
return this.drInterface.compareTo(((OspfPseudonode) o).drInterface);
}
return result;
}
......
......@@ -25,7 +25,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides OSPF Route Type Tlv which contains route type.
*/
public class OSPFRouteTypeTlv implements BgpValueType {
public class OspfRouteTypeTlv implements BgpValueType {
/* Reference :draft-ietf-idr-ls-distribution-11
0 1 2 3
......@@ -69,7 +69,7 @@ public class OSPFRouteTypeTlv implements BgpValueType {
*
* @param routeType Route type
*/
public OSPFRouteTypeTlv(byte routeType) {
public OspfRouteTypeTlv(byte routeType) {
this.routeType = routeType;
}
......@@ -79,8 +79,8 @@ public class OSPFRouteTypeTlv implements BgpValueType {
* @param routeType Route type
* @return object of OSPFRouteTypeTlv
*/
public static OSPFRouteTypeTlv of(final byte routeType) {
return new OSPFRouteTypeTlv(routeType);
public static OspfRouteTypeTlv of(final byte routeType) {
return new OspfRouteTypeTlv(routeType);
}
/**
......@@ -118,8 +118,8 @@ public class OSPFRouteTypeTlv implements BgpValueType {
if (this == obj) {
return true;
}
if (obj instanceof OSPFRouteTypeTlv) {
OSPFRouteTypeTlv other = (OSPFRouteTypeTlv) obj;
if (obj instanceof OspfRouteTypeTlv) {
OspfRouteTypeTlv other = (OspfRouteTypeTlv) obj;
return Objects.equals(routeType, other.routeType);
}
return false;
......@@ -140,8 +140,8 @@ public class OSPFRouteTypeTlv implements BgpValueType {
* @param cb channelBuffer
* @return object of OSPFRouteTypeTlv
*/
public static OSPFRouteTypeTlv read(ChannelBuffer cb) {
return OSPFRouteTypeTlv.of(cb.readByte());
public static OspfRouteTypeTlv read(ChannelBuffer cb) {
return OspfRouteTypeTlv.of(cb.readByte());
}
@Override
......@@ -154,7 +154,7 @@ public class OSPFRouteTypeTlv implements BgpValueType {
if (this.equals(o)) {
return 0;
}
return ((Byte) (this.routeType)).compareTo((Byte) (((OSPFRouteTypeTlv) o).routeType));
return ((Byte) (this.routeType)).compareTo((Byte) (((OspfRouteTypeTlv) o).routeType));
}
@Override
......
......@@ -15,8 +15,7 @@
*/
package org.onosproject.bgpio.types.attr;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.types.BgpErrorType;
......@@ -25,7 +24,7 @@ import org.onosproject.bgpio.util.Validation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import java.util.Objects;
/**
* Implements BGP prefix IGP Flag attribute.
......@@ -55,15 +54,15 @@ public final class BgpPrefixAttrIgpFlags implements BgpValueType {
* @param bisisUpDownBit IS-IS Up/Down Bit
* @param bOspfNoUnicastBit OSPF no unicast Bit
* @param bOspfLclAddrBit OSPF local address Bit
* @param bOspfNSSABit OSPF propagate NSSA Bit
* @param bOspfNssaBit OSPF propagate NSSA Bit
*/
public BgpPrefixAttrIgpFlags(boolean bisisUpDownBit,
boolean bOspfNoUnicastBit,
boolean bOspfLclAddrBit, boolean bOspfNSSABit) {
boolean bOspfLclAddrBit, boolean bOspfNssaBit) {
this.bisisUpDownBit = bisisUpDownBit;
this.bOspfNoUnicastBit = bOspfNoUnicastBit;
this.bOspfLclAddrBit = bOspfLclAddrBit;
this.bOspfNSSABit = bOspfNSSABit;
this.bOspfNSSABit = bOspfNssaBit;
}
/**
......@@ -72,15 +71,15 @@ public final class BgpPrefixAttrIgpFlags implements BgpValueType {
* @param bisisUpDownBit IS-IS Up/Down Bit
* @param bOspfNoUnicastBit OSPF no unicast Bit
* @param bOspfLclAddrBit OSPF local address Bit
* @param bOspfNSSABit OSPF propagate NSSA Bit
* @param bOspfNssaBit OSPF propagate NSSA Bit
* @return object of BgpPrefixAttrIGPFlags
*/
public static BgpPrefixAttrIgpFlags of(final boolean bisisUpDownBit,
final boolean bOspfNoUnicastBit,
final boolean bOspfLclAddrBit,
final boolean bOspfNSSABit) {
final boolean bOspfNssaBit) {
return new BgpPrefixAttrIgpFlags(bisisUpDownBit, bOspfNoUnicastBit,
bOspfLclAddrBit, bOspfNSSABit);
bOspfLclAddrBit, bOspfNssaBit);
}
/**
......@@ -95,7 +94,7 @@ public final class BgpPrefixAttrIgpFlags implements BgpValueType {
boolean bisisUpDownBit = false;
boolean bOspfNoUnicastBit = false;
boolean bOspfLclAddrBit = false;
boolean bOspfNSSABit = false;
boolean bOspfNssaBit = false;
short lsAttrLength = cb.readShort();
......@@ -111,10 +110,10 @@ public final class BgpPrefixAttrIgpFlags implements BgpValueType {
bisisUpDownBit = ((nodeFlagBits & FIRST_BIT) == FIRST_BIT);
bOspfNoUnicastBit = ((nodeFlagBits & SECOND_BIT) == SECOND_BIT);
bOspfLclAddrBit = ((nodeFlagBits & THIRD_BIT) == THIRD_BIT);
bOspfNSSABit = ((nodeFlagBits & FOURTH_BIT) == FOURTH_BIT);
bOspfNssaBit = ((nodeFlagBits & FOURTH_BIT) == FOURTH_BIT);
return BgpPrefixAttrIgpFlags.of(bisisUpDownBit, bOspfNoUnicastBit,
bOspfLclAddrBit, bOspfNSSABit);
bOspfLclAddrBit, bOspfNssaBit);
}
/**
......@@ -149,7 +148,7 @@ public final class BgpPrefixAttrIgpFlags implements BgpValueType {
*
* @return OSPF propagate NSSA Bit set or not
*/
public boolean ospfNSSABit() {
public boolean ospfNssaBit() {
return bOspfNSSABit;
}
......
......@@ -35,7 +35,7 @@ import org.onosproject.bgpio.types.LinkStateAttributes;
import org.onosproject.bgpio.types.Med;
import org.onosproject.bgpio.types.MpReachNlri;
import org.onosproject.bgpio.types.Origin;
import org.onosproject.bgpio.types.Origin.ORIGINTYPE;
import org.onosproject.bgpio.types.Origin.OriginType;
import org.onosproject.bgpio.types.attr.BgpAttrNodeFlagBitTlv;
import org.onosproject.bgpio.types.attr.BgpAttrNodeIsIsAreaId;
import org.onosproject.bgpio.types.attr.BgpAttrNodeMultiTopologyId;
......@@ -132,7 +132,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
//compare Origin
testPathAttribute = listIterator.next();
......@@ -250,7 +250,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -363,7 +363,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -477,7 +477,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -594,7 +594,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -713,7 +713,7 @@ public class BgpUpdateLinkStateAttrTest {
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -827,7 +827,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -945,7 +945,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1063,7 +1063,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1175,7 +1175,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1288,7 +1288,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1400,7 +1400,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1513,7 +1513,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1626,7 +1626,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1739,7 +1739,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1840,7 +1840,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1935,7 +1935,7 @@ public class BgpUpdateLinkStateAttrTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......
......@@ -16,10 +16,6 @@
package org.onosproject.bgpio.protocol;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
......@@ -43,13 +39,13 @@ import org.onosproject.bgpio.types.IPReachabilityInformationTlv;
import org.onosproject.bgpio.types.IsIsNonPseudonode;
import org.onosproject.bgpio.types.IsIsPseudonode;
import org.onosproject.bgpio.types.LinkStateAttributes;
import org.onosproject.bgpio.types.LocalPref;
import org.onosproject.bgpio.types.Med;
import org.onosproject.bgpio.types.MpReachNlri;
import org.onosproject.bgpio.types.MpUnReachNlri;
import org.onosproject.bgpio.types.Origin;
import org.onosproject.bgpio.types.NextHop;
import org.onosproject.bgpio.types.LocalPref;
import org.onosproject.bgpio.types.Origin.ORIGINTYPE;
import org.onosproject.bgpio.types.Origin;
import org.onosproject.bgpio.types.Origin.OriginType;
import org.onosproject.bgpio.types.attr.BgpAttrRouterIdV4;
import org.onosproject.bgpio.types.attr.BgpLinkAttrName;
import org.onosproject.bgpio.types.attr.BgpPrefixAttrExtRouteTag;
......@@ -61,6 +57,10 @@ import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
/**
* Test cases for BGP update Message.
*/
......@@ -255,7 +255,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -639,7 +639,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -684,13 +684,13 @@ public class BgpUpdateMsgTest {
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
BgpLSIdentifierTlv testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
BgpLSIdentifierTlv testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist1.next();
byte[] expISONodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
assertThat(testIsIsNonPseudonode.getISONodeID(), is(expISONodeID));
byte[] expIsoNodeId = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
assertThat(testIsIsNonPseudonode.getIsoNodeId(), is(expIsoNodeId));
assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
}
......@@ -763,7 +763,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -807,13 +807,13 @@ public class BgpUpdateMsgTest {
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
BgpLSIdentifierTlv testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
BgpLSIdentifierTlv testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist1.next();
byte[] expISONodeID = new byte[] {0x19, 0x21, 0x68, 0x07, 0x70, 0x01};
assertThat(testIsIsNonPseudonode.getISONodeID(), is(expISONodeID));
byte[] expIsoNodeId = new byte[] {0x19, 0x21, 0x68, 0x07, 0x70, 0x01};
assertThat(testIsIsNonPseudonode.getIsoNodeId(), is(expIsoNodeId));
assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
List<BgpValueType> testPrefixDescriptors = new LinkedList<>();
......@@ -885,7 +885,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -930,12 +930,12 @@ public class BgpUpdateMsgTest {
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
BgpLSIdentifierTlv testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
BgpLSIdentifierTlv testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsPseudonode testIsIsPseudonode = (IsIsPseudonode) subtlvlist1.next();
assertThat(testIsIsPseudonode.getPSNIdentifier(), is((byte) 3));
assertThat(testIsIsPseudonode.getPsnIdentifier(), is((byte) 3));
assertThat(testIsIsPseudonode.getType(), is((short) 515));
NodeDescriptors testRemoteNodeDescriptors = testlinknlri.remoteNodeDescriptors();
......@@ -947,13 +947,13 @@ public class BgpUpdateMsgTest {
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist2.next();
assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist2.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist2.next();
byte[] expISONodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21};
assertThat(testIsIsNonPseudonode.getISONodeID(), is(expISONodeID));
byte[] expIsoNodeId = new byte[] {0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21};
assertThat(testIsIsNonPseudonode.getIsoNodeId(), is(expIsoNodeId));
assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
}
......@@ -1231,7 +1231,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1239,7 +1239,7 @@ public class BgpUpdateMsgTest {
testPathAttribute = listIterator.next();
as4Path = (As4Path) testPathAttribute;
ListIterator<Integer> listIterator2 = as4Path.as4PathSEQ().listIterator();
ListIterator<Integer> listIterator2 = as4Path.as4PathSeq().listIterator();
assertThat(listIterator2.next(), is(655361));
testPathAttribute = listIterator.next();
......@@ -1309,7 +1309,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes actualpathAttribute = other.bgpPathAttributes();
pathAttributes = actualpathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributes.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1355,13 +1355,13 @@ public class BgpUpdateMsgTest {
assertThat(testAutonomousSystemTlv.getAsNum(), is(2222));
assertThat(testAutonomousSystemTlv.getType(), is((short) 512));
BgpLSIdentifierTlv testBGPLSIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBGPLSIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBGPLSIdentifierTlv.getType(), is((short) 513));
BgpLSIdentifierTlv testBgpLsIdentifierTlv = (BgpLSIdentifierTlv) subtlvlist1.next();
assertThat(testBgpLsIdentifierTlv.getBgpLsIdentifier(), is(33686018));
assertThat(testBgpLsIdentifierTlv.getType(), is((short) 513));
IsIsNonPseudonode testIsIsNonPseudonode = (IsIsNonPseudonode) subtlvlist1.next();
byte[] expISONodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
assertThat(testIsIsNonPseudonode.getISONodeID(), is(expISONodeID));
byte[] expIsoNodeId = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
assertThat(testIsIsNonPseudonode.getIsoNodeId(), is(expIsoNodeId));
assertThat(testIsIsNonPseudonode.getType(), is((short) 515));
}
......@@ -1753,7 +1753,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1857,7 +1857,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......@@ -1954,7 +1954,7 @@ public class BgpUpdateMsgTest {
BgpPathAttributes pathAttribute = other.bgpPathAttributes();
pathAttributeList = pathAttribute.pathAttributes();
ListIterator<BgpValueType> listIterator = pathAttributeList.listIterator();
ORIGINTYPE originValue = org.onosproject.bgpio.types.Origin.ORIGINTYPE.IGP;
OriginType originValue = OriginType.IGP;
testPathAttribute = listIterator.next();
origin = (Origin) testPathAttribute;
......
......@@ -28,9 +28,9 @@ public class OspfPseudonodeTest {
private final int value2 = 0xc3223406;
private final Ip4Address drInterface1 = Ip4Address.valueOf(0xaf91e01);
private final Ip4Address drInterface2 = Ip4Address.valueOf(0xaf91e02);
private final OSPFPseudonode tlv1 = OSPFPseudonode.of(value1, drInterface1);
private final OSPFPseudonode sameAsTlv1 = OSPFPseudonode.of(value1, drInterface1);
private final OSPFPseudonode tlv2 = OSPFPseudonode.of(value2, drInterface2);
private final OspfPseudonode tlv1 = OspfPseudonode.of(value1, drInterface1);
private final OspfPseudonode sameAsTlv1 = OspfPseudonode.of(value1, drInterface1);
private final OspfPseudonode tlv2 = OspfPseudonode.of(value2, drInterface2);
@Test
public void testEquality() {
......
......@@ -25,9 +25,9 @@ import com.google.common.testing.EqualsTester;
public class OspfRouteTypeTest {
private final byte value1 = 5;
private final byte value2 = 4;
private final OSPFRouteTypeTlv tlv1 = OSPFRouteTypeTlv.of(value1);
private final OSPFRouteTypeTlv sameAsTlv1 = OSPFRouteTypeTlv.of(value1);
private final OSPFRouteTypeTlv tlv2 = OSPFRouteTypeTlv.of(value2);
private final OspfRouteTypeTlv tlv1 = OspfRouteTypeTlv.of(value1);
private final OspfRouteTypeTlv sameAsTlv1 = OspfRouteTypeTlv.of(value1);
private final OspfRouteTypeTlv tlv2 = OspfRouteTypeTlv.of(value2);
@Test
public void testEquality() {
......
......@@ -16,18 +16,6 @@
package org.onosproject.bgp.controller.impl;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.nio.channels.ClosedChannelException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.RejectedExecutionException;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
......@@ -59,6 +47,18 @@ import org.onosproject.bgpio.types.MultiProtocolExtnCapabilityTlv;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.nio.channels.ClosedChannelException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.RejectedExecutionException;
/**
* Channel handler deals with the bgp peer connection and dispatches messages from peer to the appropriate locations.
*/
......@@ -95,7 +95,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
// proceeds to cleaup peer state - we need to ensure that it does not
// cleanup
// peer state for the older (still connected) peer
private volatile Boolean duplicateBGPIdFound;
private volatile Boolean duplicateBgpIdFound;
// Indicates the bgp version used by this bgp peer
protected BgpVersion bgpVersion;
private BgpController bgpController;
......@@ -119,7 +119,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
this.peerManager = (BgpPeerManagerImpl) bgpController.peerManager();
this.state = ChannelState.IDLE;
this.factory4 = Controller.getBgpMessageFactory4();
this.duplicateBGPIdFound = Boolean.FALSE;
this.duplicateBgpIdFound = Boolean.FALSE;
this.bgpPacketStats = new BgpPacketStatsImpl();
this.bgpconfig = bgpController.getConfig();
}
......@@ -344,7 +344,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
protected void disconnectDuplicate(BgpChannelHandler h) {
log.error("Duplicated BGP IP or incompleted cleanup - " + "" + "disconnecting channel {}",
h.getPeerInfoString());
h.duplicateBGPIdFound = Boolean.TRUE;
h.duplicateBgpIdFound = Boolean.TRUE;
h.channel.disconnect();
}
......@@ -438,7 +438,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
peerAddr = IpAddress.valueOf(inetAddress.getAddress()).toString();
if (thisbgpId != null) {
if (!duplicateBGPIdFound) {
if (!duplicateBgpIdFound) {
// if the disconnected peer (on this ChannelHandler)
// was not one with a duplicate, it is safe to remove all
// state for it at the controller. Notice that if the disconnected
......@@ -449,7 +449,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
if (bgpPeer != null) {
BgpPeerImpl peer = (BgpPeerImpl) bgpPeer;
peerManager.removeConnectedPeer(thisbgpId);
peer.updateLocalRIBOnPeerDisconnect();
peer.updateLocalRibOnPeerDisconnect();
}
// Retry connection if connection is lost to bgp speaker/peer
......@@ -475,7 +475,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
// this is the same peer reconnecting, but the original state was
// not cleaned up - XXX check liveness of original ChannelHandler
log.debug("{}:duplicate found", getPeerInfoString());
duplicateBGPIdFound = Boolean.FALSE;
duplicateBgpIdFound = Boolean.FALSE;
}
stopKeepAliveTimer();
......@@ -610,7 +610,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler {
*/
private void dispatchMessage(BgpMessage m) throws BgpParseException {
bgpPacketStats.addInPacket();
bgpController.processBGPPacket(thisbgpId, m);
bgpController.processBgpPacket(thisbgpId, m);
}
/**
......
......@@ -16,14 +16,6 @@
package org.onosproject.bgp.controller.impl;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
......@@ -32,8 +24,8 @@ import org.onosproject.bgp.controller.BgpCfg;
import org.onosproject.bgp.controller.BgpController;
import org.onosproject.bgp.controller.BgpId;
import org.onosproject.bgp.controller.BgpLocalRib;
import org.onosproject.bgp.controller.BgpPeer;
import org.onosproject.bgp.controller.BgpNodeListener;
import org.onosproject.bgp.controller.BgpPeer;
import org.onosproject.bgp.controller.BgpPeerManager;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpMessage;
......@@ -44,6 +36,14 @@ import org.onosproject.bgpio.types.MpUnReachNlri;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@Component(immediate = true)
@Service
public class BgpControllerImpl implements BgpController {
......@@ -54,8 +54,8 @@ public class BgpControllerImpl implements BgpController {
protected BgpPeerManagerImpl peerManager = new BgpPeerManagerImpl();
private BgpLocalRib bgplocalRIB = new BgpLocalRibImpl(this);
private BgpLocalRib bgplocalRIBVpn = new BgpLocalRibImpl(this);
private BgpLocalRib bgplocalRib = new BgpLocalRibImpl(this);
private BgpLocalRib bgplocalRibVpn = new BgpLocalRibImpl(this);
protected Set<BgpNodeListener> bgpNodeListener = new CopyOnWriteArraySet<>();
......@@ -108,7 +108,7 @@ public class BgpControllerImpl implements BgpController {
}
@Override
public void processBGPPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException {
public void processBgpPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException {
BgpPeer peer = getPeer(bgpId);
......@@ -251,7 +251,7 @@ public class BgpControllerImpl implements BgpController {
*/
@Override
public BgpLocalRib bgpLocalRib() {
return bgplocalRIB;
return bgplocalRib;
}
/**
......@@ -261,6 +261,6 @@ public class BgpControllerImpl implements BgpController {
*/
@Override
public BgpLocalRib bgpLocalRibVpn() {
return bgplocalRIBVpn;
return bgplocalRibVpn;
}
}
......
......@@ -13,10 +13,7 @@
package org.onosproject.bgp.controller.impl;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import com.google.common.base.MoreObjects;
import org.onosproject.bgp.controller.BgpController;
import org.onosproject.bgp.controller.BgpId;
import org.onosproject.bgp.controller.BgpLocalRib;
......@@ -35,8 +32,11 @@ import org.onosproject.bgpio.types.RouteDistinguisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.MoreObjects;
/**
* Implementation of local RIB.
......@@ -447,7 +447,7 @@ public class BgpLocalRibImpl implements BgpLocalRib {
*
* @param o adjacency-in/VPN adjacency-in
*/
public void localRIBUpdateNode(Object o) {
public void localRibUpdateNode(Object o) {
if (o instanceof AdjRibIn) {
AdjRibIn adjRib = (AdjRibIn) o;
......@@ -488,7 +488,7 @@ public class BgpLocalRibImpl implements BgpLocalRib {
*
* @param o adjacency-in/VPN adjacency-in
*/
public void localRIBUpdateLink(Object o) {
public void localRibUpdateLink(Object o) {
if (o instanceof AdjRibIn) {
AdjRibIn adjRib = (AdjRibIn) o;
......@@ -529,7 +529,7 @@ public class BgpLocalRibImpl implements BgpLocalRib {
*
* @param o instance of adjacency-in/VPN adjacency-in
*/
public void localRIBUpdatePrefix(Object o) {
public void localRibUpdatePrefix(Object o) {
if (o instanceof AdjRibIn) {
AdjRibIn adjRib = (AdjRibIn) o;
......@@ -573,12 +573,12 @@ public class BgpLocalRibImpl implements BgpLocalRib {
*
* @param adjRibIn adjacency RIB-in
*/
public void localRIBUpdate(AdjRibIn adjRibIn) {
public void localRibUpdate(AdjRibIn adjRibIn) {
log.debug("Update local RIB.");
localRIBUpdateNode(adjRibIn);
localRIBUpdateLink(adjRibIn);
localRIBUpdatePrefix(adjRibIn);
localRibUpdateNode(adjRibIn);
localRibUpdateLink(adjRibIn);
localRibUpdatePrefix(adjRibIn);
}
/**
......@@ -586,12 +586,12 @@ public class BgpLocalRibImpl implements BgpLocalRib {
*
* @param vpnAdjRibIn VPN adjacency RIB-in
*/
public void localRIBUpdate(VpnAdjRibIn vpnAdjRibIn) {
public void localRibUpdate(VpnAdjRibIn vpnAdjRibIn) {
log.debug("Update VPN local RIB.");
localRIBUpdateNode(vpnAdjRibIn);
localRIBUpdateLink(vpnAdjRibIn);
localRIBUpdatePrefix(vpnAdjRibIn);
localRibUpdateNode(vpnAdjRibIn);
localRibUpdateLink(vpnAdjRibIn);
localRibUpdatePrefix(vpnAdjRibIn);
}
@Override
......
......@@ -16,27 +16,21 @@
package org.onosproject.bgp.controller.impl;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.RejectedExecutionException;
import com.google.common.base.MoreObjects;
import org.jboss.netty.channel.Channel;
import org.onlab.packet.IpAddress;
import org.onosproject.bgp.controller.BgpController;
import org.onosproject.bgp.controller.BgpLocalRib;
import org.onosproject.bgp.controller.BgpPeer;
import org.onosproject.bgp.controller.BgpSessionInfo;
import org.onosproject.bgp.controller.BgpLocalRib;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpFactories;
import org.onosproject.bgpio.protocol.BgpFactory;
import org.onosproject.bgpio.protocol.BgpLSNlri;
import org.onosproject.bgpio.protocol.BgpMessage;
import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpPrefixIPv4LSNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4;
import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.MpReachNlri;
......@@ -44,7 +38,12 @@ import org.onosproject.bgpio.types.MpUnReachNlri;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.concurrent.RejectedExecutionException;
/**
* BGPPeerImpl implements BGPPeer, maintains peer information and store updates in RIB .
......@@ -62,8 +61,8 @@ public class BgpPeerImpl implements BgpPeer {
protected boolean isHandShakeComplete = false;
private BgpSessionInfo sessionInfo;
private BgpPacketStatsImpl pktStats;
private BgpLocalRib bgplocalRIB;
private BgpLocalRib bgplocalRIBVpn;
private BgpLocalRib bgplocalRib;
private BgpLocalRib bgplocalRibVpn;
private AdjRibIn adjRib;
private VpnAdjRibIn vpnAdjRib;
......@@ -101,8 +100,8 @@ public class BgpPeerImpl implements BgpPeer {
this.bgpController = bgpController;
this.sessionInfo = sessionInfo;
this.pktStats = pktStats;
this.bgplocalRIB = bgpController.bgpLocalRib();
this.bgplocalRIBVpn = bgpController.bgpLocalRibVpn();
this.bgplocalRib = bgpController.bgpLocalRib();
this.bgplocalRibVpn = bgpController.bgpLocalRibVpn();
this.adjRib = new AdjRibIn();
this.vpnAdjRib = new VpnAdjRibIn();
}
......@@ -141,30 +140,30 @@ public class BgpPeerImpl implements BgpPeer {
PathAttrNlriDetails details = setPathAttrDetails(nlriInfo, pathAttr);
if (!((BgpNodeLSNlriVer4) nlriInfo).isVpnPresent()) {
adjRib.add(nlriInfo, details);
bgplocalRIB.add(sessionInfo(), nlriInfo, details);
bgplocalRib.add(sessionInfo(), nlriInfo, details);
} else {
vpnAdjRib.addVpn(nlriInfo, details, ((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRIBVpn.add(sessionInfo(), nlriInfo, details,
bgplocalRibVpn.add(sessionInfo(), nlriInfo, details,
((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
}
} else if (nlriInfo instanceof BgpLinkLsNlriVer4) {
PathAttrNlriDetails details = setPathAttrDetails(nlriInfo, pathAttr);
if (!((BgpLinkLsNlriVer4) nlriInfo).isVpnPresent()) {
adjRib.add(nlriInfo, details);
bgplocalRIB.add(sessionInfo(), nlriInfo, details);
bgplocalRib.add(sessionInfo(), nlriInfo, details);
} else {
vpnAdjRib.addVpn(nlriInfo, details, ((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRIBVpn.add(sessionInfo(), nlriInfo, details,
bgplocalRibVpn.add(sessionInfo(), nlriInfo, details,
((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
}
} else if (nlriInfo instanceof BgpPrefixIPv4LSNlriVer4) {
PathAttrNlriDetails details = setPathAttrDetails(nlriInfo, pathAttr);
if (!((BgpPrefixIPv4LSNlriVer4) nlriInfo).isVpnPresent()) {
adjRib.add(nlriInfo, details);
bgplocalRIB.add(sessionInfo(), nlriInfo, details);
bgplocalRib.add(sessionInfo(), nlriInfo, details);
} else {
vpnAdjRib.addVpn(nlriInfo, details, ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRIBVpn.add(sessionInfo(), nlriInfo, details,
bgplocalRibVpn.add(sessionInfo(), nlriInfo, details,
((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
}
}
......@@ -201,26 +200,26 @@ public class BgpPeerImpl implements BgpPeer {
if (nlriInfo instanceof BgpNodeLSNlriVer4) {
if (!((BgpNodeLSNlriVer4) nlriInfo).isVpnPresent()) {
adjRib.remove(nlriInfo);
bgplocalRIB.delete(nlriInfo);
bgplocalRib.delete(nlriInfo);
} else {
vpnAdjRib.removeVpn(nlriInfo, ((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRIBVpn.delete(nlriInfo, ((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRibVpn.delete(nlriInfo, ((BgpNodeLSNlriVer4) nlriInfo).getRouteDistinguisher());
}
} else if (nlriInfo instanceof BgpLinkLsNlriVer4) {
if (!((BgpLinkLsNlriVer4) nlriInfo).isVpnPresent()) {
adjRib.remove(nlriInfo);
bgplocalRIB.delete(nlriInfo);
bgplocalRib.delete(nlriInfo);
} else {
vpnAdjRib.removeVpn(nlriInfo, ((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRIBVpn.delete(nlriInfo, ((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRibVpn.delete(nlriInfo, ((BgpLinkLsNlriVer4) nlriInfo).getRouteDistinguisher());
}
} else if (nlriInfo instanceof BgpPrefixIPv4LSNlriVer4) {
if (!((BgpPrefixIPv4LSNlriVer4) nlriInfo).isVpnPresent()) {
adjRib.remove(nlriInfo);
bgplocalRIB.delete(nlriInfo);
bgplocalRib.delete(nlriInfo);
} else {
vpnAdjRib.removeVpn(nlriInfo, ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRIBVpn.delete(nlriInfo, ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
bgplocalRibVpn.delete(nlriInfo, ((BgpPrefixIPv4LSNlriVer4) nlriInfo).getRouteDistinguisher());
}
}
}
......@@ -248,12 +247,12 @@ public class BgpPeerImpl implements BgpPeer {
* Update localRIB on peer disconnect.
*
*/
public void updateLocalRIBOnPeerDisconnect() {
BgpLocalRibImpl localRib = (BgpLocalRibImpl) bgplocalRIB;
BgpLocalRibImpl localRibVpn = (BgpLocalRibImpl) bgplocalRIBVpn;
public void updateLocalRibOnPeerDisconnect() {
BgpLocalRibImpl localRib = (BgpLocalRibImpl) bgplocalRib;
BgpLocalRibImpl localRibVpn = (BgpLocalRibImpl) bgplocalRibVpn;
localRib.localRIBUpdate(adjacencyRib());
localRibVpn.localRIBUpdate(vpnAdjacencyRib());
localRib.localRibUpdate(adjacencyRib());
localRibVpn.localRibUpdate(vpnAdjacencyRib());
}
// ************************
......
......@@ -15,20 +15,20 @@
*/
package org.onosproject.bgp.controller.impl;
import java.util.Comparator;
import java.util.List;
import java.util.ListIterator;
import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib;
import org.onosproject.bgpio.types.AsPath;
import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.LocalPref;
import org.onosproject.bgpio.types.Med;
import org.onosproject.bgpio.types.Origin;
import org.onosproject.bgpio.types.Origin.ORIGINTYPE;
import org.onosproject.bgpio.types.Origin.OriginType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Comparator;
import java.util.List;
import java.util.ListIterator;
/**
* Implementation of BGP best path Selection process.
*/
......@@ -122,13 +122,13 @@ public final class BgpSelectionAlgo implements Comparator<PathAttrNlriDetailsLoc
* @return object with lowest origin value
*/
int compareOrigin(Origin obj1Origin, Origin obj2Origin) {
if (obj1Origin.origin() == ORIGINTYPE.IGP) {
if (obj1Origin.origin() == OriginType.IGP) {
return 1;
}
if (obj2Origin.origin() == ORIGINTYPE.IGP) {
if (obj2Origin.origin() == OriginType.IGP) {
return -1;
}
if (obj1Origin.origin() == ORIGINTYPE.EGP) {
if (obj1Origin.origin() == OriginType.EGP) {
return 1;
} else {
return -1;
......
......@@ -15,16 +15,12 @@
*/
package org.onosproject.controller.impl;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import java.util.LinkedList;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpAddress.Version;
import org.onosproject.bgp.controller.impl.BgpSelectionAlgo;
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4.ProtocolType;
import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails;
......@@ -34,7 +30,11 @@ import org.onosproject.bgpio.types.BgpValueType;
import org.onosproject.bgpio.types.LocalPref;
import org.onosproject.bgpio.types.Med;
import org.onosproject.bgpio.types.Origin;
import org.onosproject.bgp.controller.impl.BgpSelectionAlgo;
import java.util.LinkedList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
/**
* Test cases for BGP Selection Algorithm.
......@@ -65,14 +65,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
int bgpId = 168427777;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = false;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0b, 0x0b, 0x0b, 0x0b };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -92,14 +92,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
bgpId = 536936448;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = true;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList2);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(1));
......@@ -128,14 +128,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
int bgpId = 168427777;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = false;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0b, 0x0b, 0x0b, 0x0b };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -153,14 +153,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
bgpId = 536936448;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = true;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList2);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(-1));
......@@ -189,14 +189,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
int bgpId = 168427777;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = false;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0b, 0x0b, 0x0b, 0x0b };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -214,14 +214,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
bgpId = 536936448;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = true;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList2);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(1));
......@@ -254,14 +254,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
int bgpId = 168427777;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = false;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0b, 0x0b, 0x0b, 0x0b };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -283,14 +283,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
bgpId = 536936448;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = true;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList2);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(1));
......@@ -314,14 +314,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
int bgpId = 168427777;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = false;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0b, 0x0b, 0x0b, 0x0b };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -334,14 +334,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
bgpId = 536936448;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = true;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList2);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(-1));
......@@ -369,14 +369,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
int bgpId = 168427777;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = true;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0b, 0x0b, 0x0b, 0x0b };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -394,14 +394,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
bgpId = 536936448;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = false;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, false, attrList2);
ipAddress, bgpId, locRibAsNum, false, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(-1));
......@@ -430,14 +430,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
//A0A0A00
Integer bgpId = 168430080;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = false;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0b, 0x0b, 0x0b, 0x0b };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -456,14 +456,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
//B0A0A00
bgpId = 185207296;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = false;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList2);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(1));
......@@ -492,14 +492,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
//A0A0A00
Integer bgpId = 168430080;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = false;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0a, 0x0a, 0x0a, 0x0a };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -518,14 +518,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
//A0A0A00
bgpId = 168430080;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = false;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList2);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(-1));
......@@ -554,14 +554,14 @@ public class BgpSelectionAlgoTest {
IpAddress ipAddress = IpAddress.valueOf(Version.INET, peerIp);
//A0A0A00
Integer bgpId = 168430080;
short locRIBASNum = 100;
short locRibAsNum = 100;
boolean isIbgp = false;
PathAttrNlriDetails attrList1 = new PathAttrNlriDetails();
attrList1.setIdentifier(0);
attrList1.setPathAttribute(pathAttributes1);
attrList1.setProtocolID(ProtocolType.ISIS_LEVEL_ONE);
PathAttrNlriDetailsLocalRib list1 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList1);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList1);
peerIp = new byte[] {0x0a, 0x0a, 0x0a, 0x0a };
LinkedList<BgpValueType> pathAttributes2 = new LinkedList<>();
......@@ -580,14 +580,14 @@ public class BgpSelectionAlgoTest {
ipAddress = IpAddress.valueOf(Version.INET, peerIp);
//A0A0A00
bgpId = 168430080;
locRIBASNum = 200;
locRibAsNum = 200;
isIbgp = false;
PathAttrNlriDetails attrList2 = new PathAttrNlriDetails();
attrList2.setIdentifier(0);
attrList2.setPathAttribute(pathAttributes2);
attrList2.setProtocolID(ProtocolType.OSPF_V2);
PathAttrNlriDetailsLocalRib list2 = new PathAttrNlriDetailsLocalRib(
ipAddress, bgpId, locRIBASNum, isIbgp, attrList2);
ipAddress, bgpId, locRibAsNum, isIbgp, attrList2);
BgpSelectionAlgo algo = new BgpSelectionAlgo();
int result = algo.compare(list1, list2);
assertThat(result, is(0));
......
......@@ -20,11 +20,11 @@ import com.google.common.util.concurrent.ListenableFuture;
import org.onlab.packet.IpAddress;
import org.onosproject.net.DeviceId;
import org.onosproject.net.behaviour.ControllerInfo;
import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRPC;
import org.onosproject.ovsdb.rfc.jsonrpc.OvsdbRpc;
import org.onosproject.ovsdb.rfc.message.OperationResult;
import org.onosproject.ovsdb.rfc.message.TableUpdates;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.operations.Operation;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
......@@ -35,7 +35,7 @@ import java.util.Set;
/**
* Represents to provider facing side of a node.
*/
public interface OvsdbClientService extends OvsdbRPC {
public interface OvsdbClientService extends OvsdbRpc {
/**
* Gets the node identifier.
*
......@@ -136,7 +136,7 @@ public interface OvsdbClientService extends OvsdbRPC {
* @param bridgeUuid bridge uuid
* @param controllers list of controllers
*/
void setControllersWithUUID(UUID bridgeUuid, List<ControllerInfo> controllers);
void setControllersWithUuid(Uuid bridgeUuid, List<ControllerInfo> controllers);
/**
* Sets the Controllers for the specified device.
......
......@@ -52,7 +52,7 @@ import org.onosproject.ovsdb.rfc.notation.Mutation;
import org.onosproject.ovsdb.rfc.notation.OvsdbMap;
import org.onosproject.ovsdb.rfc.notation.OvsdbSet;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.operations.Delete;
import org.onosproject.ovsdb.rfc.operations.Insert;
import org.onosproject.ovsdb.rfc.operations.Mutate;
......@@ -255,13 +255,13 @@ public class DefaultOvsdbClient
if (bridge != null) {
OvsdbSet setPorts = (OvsdbSet) bridge.getPortsColumn().data();
@SuppressWarnings("unchecked")
Set<UUID> ports = setPorts.set();
Set<Uuid> ports = setPorts.set();
if (ports == null || ports.size() == 0) {
log.warn("The port uuid is null");
return null;
}
for (UUID uuid : ports) {
for (Uuid uuid : ports) {
Row portRow = getRow(OvsdbConstant.DATABASENAME,
OvsdbConstant.PORT, uuid.value());
Port port = (Port) TableGenerator.getTable(dbSchema, portRow,
......@@ -287,14 +287,14 @@ public class DefaultOvsdbClient
if (port != null) {
OvsdbSet setInterfaces = (OvsdbSet) port.getInterfacesColumn().data();
@SuppressWarnings("unchecked")
Set<UUID> interfaces = setInterfaces.set();
Set<Uuid> interfaces = setInterfaces.set();
if (interfaces == null || interfaces.size() == 0) {
log.warn("The interface uuid is null");
return null;
}
for (UUID uuid : interfaces) {
for (Uuid uuid : interfaces) {
Row intfRow = getRow(OvsdbConstant.DATABASENAME,
OvsdbConstant.INTERFACE, uuid.value());
Interface intf = (Interface) TableGenerator
......@@ -606,7 +606,7 @@ public class DefaultOvsdbClient
return false;
}
setControllersWithUUID(UUID.uuid(bridgeUuid), controllers);
setControllersWithUuid(Uuid.uuid(bridgeUuid), controllers);
return true;
}
......@@ -623,11 +623,11 @@ public class DefaultOvsdbClient
ControllerInfo controllerInfo = new ControllerInfo(ipAddress, OvsdbConstant.OFPORT, "tcp");
log.debug("Automatically setting controller for bridge {} to {}",
bridgeUuid, controllerInfo.target());
setControllersWithUUID(UUID.uuid(bridgeUuid), ImmutableList.of(controllerInfo));
setControllersWithUuid(Uuid.uuid(bridgeUuid), ImmutableList.of(controllerInfo));
}
@Override
public void setControllersWithUUID(UUID bridgeUuid, List<ControllerInfo> controllers) {
public void setControllersWithUuid(Uuid bridgeUuid, List<ControllerInfo> controllers) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
if (dbSchema == null) {
......@@ -640,7 +640,7 @@ public class DefaultOvsdbClient
return;
}
Set<UUID> newControllerUuids = new HashSet<>();
Set<Uuid> newControllerUuids = new HashSet<>();
Set<ControllerInfo> newControllers = new HashSet<>(controllers);
List<Controller> removeControllers = new ArrayList<>();
......@@ -672,7 +672,7 @@ public class DefaultOvsdbClient
String uuid = insertConfig(OvsdbConstant.CONTROLLER, "_uuid",
OvsdbConstant.BRIDGE, "controller", bridgeUuid.value(),
c.getRow());
newControllerUuids.add(UUID.uuid(uuid));
newControllerUuids.add(Uuid.uuid(uuid));
});
......@@ -691,17 +691,17 @@ public class DefaultOvsdbClient
@Override
public void setControllersWithDeviceId(DeviceId deviceId, List<ControllerInfo> controllers) {
setControllersWithUUID(getBridgeUUID(deviceId), controllers);
setControllersWithUuid(getBridgeUuid(deviceId), controllers);
}
@Override
public void dropBridge(String bridgeName) {
String bridgeUUID = getBridgeUuid(bridgeName);
if (bridgeUUID == null) {
String bridgeUuid = getBridgeUuid(bridgeName);
if (bridgeUuid == null) {
log.warn("Could not find bridge in node", nodeId.getIpAddress());
return;
}
deleteConfig(OvsdbConstant.BRIDGE, "_uuid", bridgeUUID,
deleteConfig(OvsdbConstant.BRIDGE, "_uuid", bridgeUuid,
OvsdbConstant.DATABASENAME, "bridges");
}
......@@ -798,12 +798,12 @@ public class DefaultOvsdbClient
Port port = (Port) TableGenerator.createTable(dbSchema, OvsdbTable.PORT);
port.setName(portName);
Insert portInsert = new Insert(dbSchema.getTableSchema("Port"), "Port", port.getRow());
portInsert.getRow().put("interfaces", UUID.uuid("Interface"));
portInsert.getRow().put("interfaces", Uuid.uuid("Interface"));
operations.add(portInsert);
// update the bridge table
Condition condition = ConditionUtil.isEqual("_uuid", UUID.uuid(bridgeUuid));
Mutation mutation = MutationUtil.insert("ports", UUID.uuid("Port"));
Condition condition = ConditionUtil.isEqual("_uuid", Uuid.uuid(bridgeUuid));
Mutation mutation = MutationUtil.insert("ports", Uuid.uuid("Port"));
List<Condition> conditions = new ArrayList<>(Arrays.asList(condition));
List<Mutation> mutations = new ArrayList<>(Arrays.asList(mutation));
operations.add(new Mutate(dbSchema.getTableSchema("Bridge"), conditions, mutations));
......@@ -831,10 +831,10 @@ public class DefaultOvsdbClient
return;
}
String portUUID = getPortUuid(portName, bridgeUuid);
if (portUUID != null) {
String portUuid = getPortUuid(portName, bridgeUuid);
if (portUuid != null) {
log.info("Delete tunnel");
deleteConfig(OvsdbConstant.PORT, "_uuid", portUUID,
deleteConfig(OvsdbConstant.PORT, "_uuid", portUuid,
OvsdbConstant.BRIDGE, "ports");
}
......@@ -864,18 +864,18 @@ public class DefaultOvsdbClient
.getColumnSchema(parentColumnName);
List<Mutation> mutations = Lists.newArrayList();
Mutation mutation = MutationUtil.delete(parentColumnSchema.name(),
UUID.uuid(childUuid));
Uuid.uuid(childUuid));
mutations.add(mutation);
List<Condition> conditions = Lists.newArrayList();
Condition condition = ConditionUtil.includes(parentColumnName,
UUID.uuid(childUuid));
Uuid.uuid(childUuid));
conditions.add(condition);
Mutate op = new Mutate(parentTableSchema, conditions, mutations);
operations.add(op);
}
List<Condition> conditions = Lists.newArrayList();
Condition condition = ConditionUtil.isEqual(childColumnName, UUID.uuid(childUuid));
Condition condition = ConditionUtil.isEqual(childColumnName, Uuid.uuid(childUuid));
conditions.add(condition);
Delete del = new Delete(childTableSchema, conditions);
operations.add(del);
......@@ -898,7 +898,7 @@ public class DefaultOvsdbClient
TableSchema tableSchema = dbSchema.getTableSchema(tableName);
List<Condition> conditions = Lists.newArrayList();
Condition condition = ConditionUtil.isEqual(columnName, UUID.uuid(uuid));
Condition condition = ConditionUtil.isEqual(columnName, Uuid.uuid(uuid));
conditions.add(condition);
Update update = new Update(tableSchema, row, conditions);
......@@ -940,12 +940,12 @@ public class DefaultOvsdbClient
List<Mutation> mutations = Lists.newArrayList();
Mutation mutation = MutationUtil.insert(parentColumnSchema.name(),
UUID.uuid(namedUuid));
Uuid.uuid(namedUuid));
mutations.add(mutation);
List<Condition> conditions = Lists.newArrayList();
Condition condition = ConditionUtil.isEqual("_uuid",
UUID.uuid(parentUuid));
Uuid.uuid(parentUuid));
conditions.add(condition);
Mutate op = new Mutate(parentTableSchema, conditions, mutations);
......@@ -962,7 +962,7 @@ public class DefaultOvsdbClient
Insert ins = (Insert) operations.get(0);
ins.getRow().put("interfaces",
UUID.uuid(OvsdbConstant.INTERFACE));
Uuid.uuid(OvsdbConstant.INTERFACE));
}
List<OperationResult> results;
......@@ -1250,7 +1250,7 @@ public class DefaultOvsdbClient
@Override
public Set<ControllerInfo> getControllers(DeviceId openflowDeviceId) {
UUID bridgeUuid = getBridgeUUID(openflowDeviceId);
Uuid bridgeUuid = getBridgeUuid(openflowDeviceId);
if (bridgeUuid == null) {
log.warn("bad bridge Uuid");
return null;
......@@ -1266,7 +1266,7 @@ public class DefaultOvsdbClient
.data())).collect(Collectors.toSet());
}
private List<Controller> getControllers(UUID bridgeUuid) {
private List<Controller> getControllers(Uuid bridgeUuid) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
if (dbSchema == null) {
return null;
......@@ -1285,7 +1285,7 @@ public class DefaultOvsdbClient
//FIXME remove log
log.warn("type of controller column", bridge.getControllerColumn()
.data().getClass());
Set<UUID> controllerUuids = (Set<UUID>) ((OvsdbSet) bridge
Set<Uuid> controllerUuids = (Set<Uuid>) ((OvsdbSet) bridge
.getControllerColumn().data()).set();
// Set<String> controllerUuidStrings = (Set<String>) bridge.getControllerColumn().data();
......@@ -1299,7 +1299,7 @@ public class DefaultOvsdbClient
List<Controller> ovsdbControllers = new ArrayList<>();
ConcurrentMap<String, Row> controllerTableRows = controllerRowStore.getRowStore();
controllerTableRows.forEach((key, row) -> {
if (!controllerUuids.contains(UUID.uuid(key))) {
if (!controllerUuids.contains(Uuid.uuid(key))) {
return;
}
Controller controller = (Controller) TableGenerator
......@@ -1310,7 +1310,7 @@ public class DefaultOvsdbClient
}
private UUID getBridgeUUID(DeviceId openflowDeviceId) {
private Uuid getBridgeUuid(DeviceId openflowDeviceId) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
if (dbSchema == null) {
return null;
......@@ -1323,13 +1323,13 @@ public class DefaultOvsdbClient
}
ConcurrentMap<String, Row> bridgeTableRows = rowStore.getRowStore();
final AtomicReference<UUID> uuid = new AtomicReference<>();
final AtomicReference<Uuid> uuid = new AtomicReference<>();
for (Map.Entry<String, Row> entry : bridgeTableRows.entrySet()) {
Bridge b = (Bridge) TableGenerator.getTable(dbSchema,
entry.getValue(),
OvsdbTable.BRIDGE);
if (matchesDpid(b, openflowDeviceId)) {
uuid.set(UUID.uuid(entry.getKey()));
uuid.set(Uuid.uuid(entry.getKey()));
break;
}
}
......
......@@ -30,7 +30,7 @@ import org.onosproject.ovsdb.controller.OvsdbTunnel;
import org.onosproject.ovsdb.rfc.message.OperationResult;
import org.onosproject.ovsdb.rfc.message.TableUpdates;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.operations.Operation;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
......@@ -94,7 +94,7 @@ public class OvsdbClientServiceAdapter implements OvsdbClientService {
}
@Override
public void setControllersWithUUID(UUID bridgeUuid, List<ControllerInfo> controllers) {
public void setControllersWithUuid(Uuid bridgeUuid, List<ControllerInfo> controllers) {
}
......
......@@ -47,7 +47,7 @@ import org.onosproject.ovsdb.rfc.message.UpdateNotification;
import org.onosproject.ovsdb.rfc.notation.OvsdbMap;
import org.onosproject.ovsdb.rfc.notation.OvsdbSet;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.table.Bridge;
import org.onosproject.ovsdb.rfc.table.Interface;
......@@ -221,7 +221,7 @@ public class OvsdbControllerImpl implements OvsdbController {
for (String tableName : updates.result().keySet()) {
TableUpdate update = updates.result().get(tableName);
for (UUID uuid : (Set<UUID>) update.rows().keySet()) {
for (Uuid uuid : (Set<Uuid>) update.rows().keySet()) {
log.debug("Begin to process table updates uuid: {}, databaseName: {}, tableName: {}",
uuid.value(), dbName, tableName);
......
......@@ -15,18 +15,17 @@
*/
package org.onosproject.ovsdb.rfc.jsonrpc;
import java.util.List;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.util.concurrent.ListenableFuture;
import org.onosproject.ovsdb.rfc.operations.Operation;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.List;
/**
* The following interface describe the RPC7047's methods that are supported.
*/
public interface OvsdbRPC {
public interface OvsdbRpc {
/**
* This operation retrieves a database-schema that describes hosted database
......
......@@ -20,7 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
......@@ -30,7 +30,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public final class OperationResult {
private int count;
private UUID uuid;
private Uuid uuid;
private List<Row> rows;
private String error;
private String details;
......@@ -59,7 +59,7 @@ public final class OperationResult {
* @param error error message
* @param details details of error message
*/
public OperationResult(int count, UUID uuid, List<Row> rows, String error,
public OperationResult(int count, Uuid uuid, List<Row> rows, String error,
String details) {
checkNotNull(uuid, "uuid cannot be null");
checkNotNull(rows, "rows cannot be null");
......@@ -92,7 +92,7 @@ public final class OperationResult {
* Return uuid.
* @return uuid
*/
public UUID getUuid() {
public Uuid getUuid() {
return uuid;
}
......@@ -100,7 +100,7 @@ public final class OperationResult {
* Set uuid value.
* @param uuid the Operation message of uuid
*/
public void setUuid(UUID uuid) {
public void setUuid(Uuid uuid) {
checkNotNull(uuid, "uuid cannot be null");
this.uuid = uuid;
}
......
......@@ -21,7 +21,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
/**
* A TableUpdate is an object that maps from the row's UUID to a RowUpdate object.
......@@ -29,7 +29,7 @@ import org.onosproject.ovsdb.rfc.notation.UUID;
* Refer to RFC 7047 Section 4.1.6.
*/
public final class RowUpdate {
private final UUID uuid;
private final Uuid uuid;
private final Row oldRow;
private final Row newRow;
......@@ -39,7 +39,7 @@ public final class RowUpdate {
* @param oldRow present for "delete" and "modify" updates
* @param newRow present for "initial", "insert", and "modify" updates
*/
public RowUpdate(UUID uuid, Row oldRow, Row newRow) {
public RowUpdate(Uuid uuid, Row oldRow, Row newRow) {
checkNotNull(uuid, "uuid cannot be null");
this.uuid = uuid;
this.oldRow = oldRow;
......@@ -50,7 +50,7 @@ public final class RowUpdate {
* Return uuid.
* @return uuid
*/
public UUID uuid() {
public Uuid uuid() {
return this.uuid;
}
......
......@@ -22,20 +22,20 @@ import java.util.Map;
import java.util.Objects;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
/**
* TableUpdate is an object that maps from the row's UUID to a RowUpdate object.
*/
public final class TableUpdate {
private final Map<UUID, RowUpdate> rows;
private final Map<Uuid, RowUpdate> rows;
/**
* Constructs a TableUpdate object.
* @param rows the parameter of TableUpdate entity
*/
private TableUpdate(Map<UUID, RowUpdate> rows) {
private TableUpdate(Map<Uuid, RowUpdate> rows) {
this.rows = rows;
}
......@@ -44,7 +44,7 @@ public final class TableUpdate {
* @param rows the parameter of TableUpdate entity
* @return TableUpdate entity
*/
public static TableUpdate tableUpdate(Map<UUID, RowUpdate> rows) {
public static TableUpdate tableUpdate(Map<Uuid, RowUpdate> rows) {
checkNotNull(rows, "rows cannot be null");
return new TableUpdate(rows);
}
......@@ -54,7 +54,7 @@ public final class TableUpdate {
* @param uuid the key of rows
* @return Row old row
*/
public Row getOld(UUID uuid) {
public Row getOld(Uuid uuid) {
RowUpdate rowUpdate = rows.get(uuid);
if (rowUpdate == null) {
return null;
......@@ -67,7 +67,7 @@ public final class TableUpdate {
* @param uuid the key of rows
* @return Row new row
*/
public Row getNew(UUID uuid) {
public Row getNew(Uuid uuid) {
RowUpdate rowUpdate = rows.get(uuid);
if (rowUpdate == null) {
return null;
......@@ -79,7 +79,7 @@ public final class TableUpdate {
* Return rows.
* @return rows
*/
public Map<UUID, RowUpdate> rows() {
public Map<Uuid, RowUpdate> rows() {
return rows;
}
......
......@@ -29,7 +29,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/
public final class Row {
private String tableName;
private UUID uuid;
private Uuid uuid;
private Map<String, Column> columns;
/**
......@@ -59,7 +59,7 @@ public final class Row {
* @param columns Map of Column entity
* @param uuid UUID of the row
*/
public Row(String tableName, UUID uuid, Map<String, Column> columns) {
public Row(String tableName, Uuid uuid, Map<String, Column> columns) {
checkNotNull(tableName, "table name cannot be null");
checkNotNull(uuid, "uuid cannot be null");
checkNotNull(columns, "columns cannot be null");
......@@ -91,7 +91,7 @@ public final class Row {
*
* @return uuid
*/
public UUID uuid() {
public Uuid uuid() {
return uuid;
}
......@@ -100,7 +100,7 @@ public final class Row {
*
* @param uuid new uuid
*/
public void setUuid(UUID uuid) {
public void setUuid(Uuid uuid) {
this.uuid = uuid;
}
......
......@@ -20,8 +20,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onosproject.ovsdb.rfc.notation.json.UUIDConverter;
import org.onosproject.ovsdb.rfc.notation.json.UUIDSerializer;
import org.onosproject.ovsdb.rfc.notation.json.UuidConverter;
import org.onosproject.ovsdb.rfc.notation.json.UuidSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
......@@ -29,16 +29,16 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
* Handles both uuid and named-uuid.
*/
@JsonSerialize(using = UUIDSerializer.class)
@JsonDeserialize(converter = UUIDConverter.class)
public final class UUID {
@JsonSerialize(using = UuidSerializer.class)
@JsonDeserialize(converter = UuidConverter.class)
public final class Uuid {
private final String value;
/**
* UUID constructor.
* @param value UUID value
*/
private UUID(String value) {
private Uuid(String value) {
checkNotNull(value, "value cannot be null");
this.value = value;
}
......@@ -48,8 +48,8 @@ public final class UUID {
* @param value UUID value
* @return UUID
*/
public static UUID uuid(String value) {
return new UUID(value);
public static Uuid uuid(String value) {
return new Uuid(value);
}
/**
......@@ -70,8 +70,8 @@ public final class UUID {
if (this == obj) {
return true;
}
if (obj instanceof UUID) {
final UUID other = (UUID) obj;
if (obj instanceof Uuid) {
final Uuid other = (Uuid) obj;
return Objects.equals(this.value, other.value);
}
return false;
......
......@@ -15,7 +15,7 @@
*/
package org.onosproject.ovsdb.rfc.notation.json;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.util.StdConverter;
......@@ -23,10 +23,10 @@ import com.fasterxml.jackson.databind.util.StdConverter;
/**
* UUIDConverter Converter.
*/
public class UUIDConverter extends StdConverter<JsonNode, UUID> {
public class UuidConverter extends StdConverter<JsonNode, Uuid> {
@Override
public UUID convert(JsonNode json) {
return UUID.uuid(json.get(1).asText());
public Uuid convert(JsonNode json) {
return Uuid.uuid(json.get(1).asText());
}
}
......
......@@ -15,20 +15,19 @@
*/
package org.onosproject.ovsdb.rfc.notation.json;
import java.io.IOException;
import org.onosproject.ovsdb.rfc.notation.UUID;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import java.io.IOException;
/**
* UUID Serializer.
*/
public class UUIDSerializer extends JsonSerializer<UUID> {
public class UuidSerializer extends JsonSerializer<Uuid> {
@Override
public void serialize(UUID value, JsonGenerator generator,
public void serialize(Uuid value, JsonGenerator generator,
SerializerProvider provider) throws IOException {
generator.writeStartArray();
String reg = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
......
......@@ -18,7 +18,7 @@ package org.onosproject.ovsdb.rfc.table;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.OvsdbSet;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
......@@ -212,7 +212,7 @@ public class Bridge extends AbstractOvsdbTableService {
* attributes.
* @param ports the column data which column name is "ports"
*/
public void setPorts(Set<UUID> ports) {
public void setPorts(Set<Uuid> ports) {
ColumnDescription columndesc = new ColumnDescription(
BridgeColumn.PORTS
.columnName(),
......@@ -240,7 +240,7 @@ public class Bridge extends AbstractOvsdbTableService {
* attributes.
* @param mirrors the column data which column name is "mirrors"
*/
public void setMirrors(Set<UUID> mirrors) {
public void setMirrors(Set<Uuid> mirrors) {
ColumnDescription columndesc = new ColumnDescription(
BridgeColumn.MIRRORS
.columnName(),
......@@ -268,7 +268,7 @@ public class Bridge extends AbstractOvsdbTableService {
* attributes.
* @param netflow the column data which column name is "netflow"
*/
public void setNetflow(Set<UUID> netflow) {
public void setNetflow(Set<Uuid> netflow) {
ColumnDescription columndesc = new ColumnDescription(
BridgeColumn.NETFLOW
.columnName(),
......@@ -296,7 +296,7 @@ public class Bridge extends AbstractOvsdbTableService {
* attributes.
* @param sflow the column data which column name is "sflow"
*/
public void setSflow(Set<UUID> sflow) {
public void setSflow(Set<Uuid> sflow) {
ColumnDescription columndesc = new ColumnDescription(
BridgeColumn.SFLOW
.columnName(),
......@@ -324,7 +324,7 @@ public class Bridge extends AbstractOvsdbTableService {
* attributes.
* @param ipfix the column data which column name is "ipfix"
*/
public void setIpfix(Set<UUID> ipfix) {
public void setIpfix(Set<Uuid> ipfix) {
ColumnDescription columndesc = new ColumnDescription(
BridgeColumn.IPFIX
.columnName(),
......@@ -548,7 +548,7 @@ public class Bridge extends AbstractOvsdbTableService {
* of attributes.
* @param flowTables the column data which column name is "flow_tables"
*/
public void setFlowTables(Map<Long, UUID> flowTables) {
public void setFlowTables(Map<Long, Uuid> flowTables) {
ColumnDescription columndesc = new ColumnDescription(
BridgeColumn.FLOWTABLES
.columnName(),
......
......@@ -19,7 +19,7 @@ import java.util.Map;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
......@@ -97,7 +97,7 @@ public class FlowSampleCollectorSet extends AbstractOvsdbTableService {
* attributes.
* @param bridge the column data which column name is "bridge"
*/
public void setBridge(UUID bridge) {
public void setBridge(Uuid bridge) {
ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.BRIDGE.columnName(),
"setBridge", VersionNum.VERSION710);
super.setDataHandler(columndesc, bridge);
......@@ -119,7 +119,7 @@ public class FlowSampleCollectorSet extends AbstractOvsdbTableService {
* attributes.
* @param ipfix the column data which column name is "ipfix"
*/
public void setIpfix(UUID ipfix) {
public void setIpfix(Uuid ipfix) {
ColumnDescription columndesc = new ColumnDescription(FlowSampleCollectorSetColumn.IPFIX.columnName(),
"setIpfix", VersionNum.VERSION710);
super.setDataHandler(columndesc, ipfix);
......
......@@ -20,7 +20,7 @@ import java.util.Set;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
......@@ -114,7 +114,7 @@ public class Mirror extends AbstractOvsdbTableService {
* @param selectSrcPort the column data which column name is
* "select_src_port"
*/
public void setSelectSrcPort(Set<UUID> selectSrcPort) {
public void setSelectSrcPort(Set<Uuid> selectSrcPort) {
ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTSRCPORT.columnName(),
"setSelectSrcPort", VersionNum.VERSION100);
super.setDataHandler(columndesc, selectSrcPort);
......@@ -137,7 +137,7 @@ public class Mirror extends AbstractOvsdbTableService {
* @param selectDstPrt the column data which column name is
* "select_dst_port"
*/
public void setSelectDstPort(Set<UUID> selectDstPrt) {
public void setSelectDstPort(Set<Uuid> selectDstPrt) {
ColumnDescription columndesc = new ColumnDescription(MirrorColumn.SELECTDSTPORT.columnName(),
"setSelectDstPort", VersionNum.VERSION100);
super.setDataHandler(columndesc, selectDstPrt);
......@@ -181,7 +181,7 @@ public class Mirror extends AbstractOvsdbTableService {
* of attributes.
* @param outputPort the column data which column name is "output_port"
*/
public void setOutputPort(Set<UUID> outputPort) {
public void setOutputPort(Set<Uuid> outputPort) {
ColumnDescription columndesc = new ColumnDescription(MirrorColumn.OUTPUTPORT.columnName(),
"setOutputPort", VersionNum.VERSION100);
super.setDataHandler(columndesc, outputPort);
......
......@@ -20,7 +20,7 @@ import java.util.Set;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
......@@ -85,7 +85,7 @@ public class OpenVSwitch extends AbstractOvsdbTableService {
* attributes.
* @param bridges the column data which column name is "bridges"
*/
public void setBridges(Set<UUID> bridges) {
public void setBridges(Set<Uuid> bridges) {
ColumnDescription columndesc = new ColumnDescription(
OpenVSwitchColumn.BRIDGES
.columnName(),
......@@ -114,7 +114,7 @@ public class OpenVSwitch extends AbstractOvsdbTableService {
* attributes.
* @param managers the column data which column name is "managers"
*/
public void setManagers(Set<UUID> managers) {
public void setManagers(Set<Uuid> managers) {
ColumnDescription columndesc = new ColumnDescription(
OpenVSwitchColumn.MANAGERS
.columnName(),
......@@ -144,7 +144,7 @@ public class OpenVSwitch extends AbstractOvsdbTableService {
* @param managerOptions the column data which column name is
* "manager_options"
*/
public void setManagerOptions(Set<UUID> managerOptions) {
public void setManagerOptions(Set<Uuid> managerOptions) {
ColumnDescription columndesc = new ColumnDescription(
OpenVSwitchColumn.MANAGEROPTIONS
.columnName(),
......@@ -172,7 +172,7 @@ public class OpenVSwitch extends AbstractOvsdbTableService {
* attributes.
* @param ssl the column data which column name is "ssl"
*/
public void setSsl(Set<UUID> ssl) {
public void setSsl(Set<Uuid> ssl) {
ColumnDescription columndesc = new ColumnDescription(
OpenVSwitchColumn.SSL
.columnName(),
......@@ -313,7 +313,7 @@ public class OpenVSwitch extends AbstractOvsdbTableService {
* of attributes.
* @param capabilities the column data which column name is "capabilities"
*/
public void setCapabilities(Map<String, UUID> capabilities) {
public void setCapabilities(Map<String, Uuid> capabilities) {
ColumnDescription columndesc = new ColumnDescription(
OpenVSwitchColumn.CAPABILITIES
.columnName(),
......
......@@ -20,7 +20,7 @@ import java.util.Set;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
......@@ -126,7 +126,7 @@ public class Port extends AbstractOvsdbTableService {
* of attributes.
* @param interfaces the column data which column name is "interfaces"
*/
public void setInterfaces(Set<UUID> interfaces) {
public void setInterfaces(Set<Uuid> interfaces) {
ColumnDescription columndesc = new ColumnDescription(
PortColumn.INTERFACES
.columnName(),
......@@ -238,7 +238,7 @@ public class Port extends AbstractOvsdbTableService {
* attributes.
* @param qos the column data which column name is "qos"
*/
public void setQos(Set<UUID> qos) {
public void setQos(Set<Uuid> qos) {
ColumnDescription columndesc = new ColumnDescription(
PortColumn.QOS
.columnName(),
......
......@@ -20,7 +20,7 @@ import java.util.Set;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.tableservice.AbstractOvsdbTableService;
import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
......@@ -75,7 +75,7 @@ public class Qos extends AbstractOvsdbTableService {
* attributes.
* @param queues the column data which column name is "queues"
*/
public void setQueues(Map<Long, UUID> queues) {
public void setQueues(Map<Long, Uuid> queues) {
ColumnDescription columndesc = new ColumnDescription(QosColumn.QUEUES.columnName(), "setQueues",
VersionNum.VERSION100);
super.setDataHandler(columndesc, queues);
......
......@@ -25,7 +25,7 @@ import org.onosproject.ovsdb.rfc.exception.TableSchemaNotFoundException;
import org.onosproject.ovsdb.rfc.exception.VersionMismatchException;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.ColumnSchema;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
import org.onosproject.ovsdb.rfc.schema.TableSchema;
......@@ -196,12 +196,12 @@ public abstract class AbstractOvsdbTableService implements OvsdbTableService {
}
@Override
public UUID getTableUuid() {
public Uuid getTableUuid() {
if (!isValid()) {
return null;
}
ColumnDescription columnDesc = new ColumnDescription("_uuid", "getTableUuid");
return (UUID) getDataHandler(columnDesc);
return (Uuid) getDataHandler(columnDesc);
}
@Override
......@@ -214,12 +214,12 @@ public abstract class AbstractOvsdbTableService implements OvsdbTableService {
}
@Override
public UUID getTableVersion() {
public Uuid getTableVersion() {
if (!isValid()) {
return null;
}
ColumnDescription columnDesc = new ColumnDescription("_version", "getTableVersion");
return (UUID) getDataHandler(columnDesc);
return (Uuid) getDataHandler(columnDesc);
}
@Override
......
......@@ -16,7 +16,7 @@
package org.onosproject.ovsdb.rfc.tableservice;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
/**
* Representation of conversion between Ovsdb table and Row.
......@@ -48,7 +48,7 @@ public interface OvsdbTableService {
* Returns UUID which column name is _uuid.
* @return UUID
*/
public UUID getTableUuid();
public Uuid getTableUuid();
/**
* Returns UUID Column which column name is _uuid.
......@@ -60,7 +60,7 @@ public interface OvsdbTableService {
* Returns UUID which column name is _version.
* @return UUID
*/
public UUID getTableVersion();
public Uuid getTableVersion();
/**
* Returns UUID Column which column name is _version.
......
......@@ -31,7 +31,7 @@ import org.onosproject.ovsdb.rfc.message.TableUpdates;
import org.onosproject.ovsdb.rfc.message.UpdateNotification;
import org.onosproject.ovsdb.rfc.notation.Column;
import org.onosproject.ovsdb.rfc.notation.Row;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.operations.Operation;
import org.onosproject.ovsdb.rfc.schema.ColumnSchema;
import org.onosproject.ovsdb.rfc.schema.DatabaseSchema;
......@@ -276,12 +276,12 @@ public final class FromJsonUtil {
* @return TableUpdate
*/
public static TableUpdate jsonNodeToTableUpdate(TableSchema tableSchema, JsonNode updateJson) {
Map<UUID, RowUpdate> rows = Maps.newHashMap();
Map<Uuid, RowUpdate> rows = Maps.newHashMap();
Iterator<Map.Entry<String, JsonNode>> tableUpdateItr = updateJson.fields();
while (tableUpdateItr.hasNext()) {
Map.Entry<String, JsonNode> oldNewRow = tableUpdateItr.next();
String uuidStr = oldNewRow.getKey();
UUID uuid = UUID.uuid(uuidStr);
Uuid uuid = Uuid.uuid(uuidStr);
JsonNode newR = oldNewRow.getValue().get("new");
JsonNode oldR = oldNewRow.getValue().get("old");
Row newRow = newR != null ? createRow(tableSchema, uuid, newR) : null;
......@@ -298,7 +298,7 @@ public final class FromJsonUtil {
* @param rowNode JsonNode
* @return Row
*/
private static Row createRow(TableSchema tableSchema, UUID uuid, JsonNode rowNode) {
private static Row createRow(TableSchema tableSchema, Uuid uuid, JsonNode rowNode) {
if (tableSchema == null) {
return null;
}
......
......@@ -21,7 +21,7 @@ import java.util.Set;
import org.onosproject.ovsdb.rfc.notation.OvsdbMap;
import org.onosproject.ovsdb.rfc.notation.OvsdbSet;
import org.onosproject.ovsdb.rfc.notation.RefTableRow;
import org.onosproject.ovsdb.rfc.notation.UUID;
import org.onosproject.ovsdb.rfc.notation.Uuid;
import org.onosproject.ovsdb.rfc.schema.type.AtomicColumnType;
import org.onosproject.ovsdb.rfc.schema.type.BaseType;
import org.onosproject.ovsdb.rfc.schema.type.BooleanBaseType;
......@@ -160,7 +160,7 @@ public final class TransValueUtil {
if (valueNode.get(0).isTextual()
&& ("uuid".equals(valueNode.get(0).asText()) || "named-uuid"
.equals(valueNode.get(0).asText()))) {
return UUID.uuid(valueNode.get(1).asText());
return Uuid.uuid(valueNode.get(1).asText());
}
}
} else {
......
......@@ -145,10 +145,10 @@ public class PcInitiatedLspRequestVer1 implements PcInitiatedLspRequest {
*/
public static class Builder implements PcInitiatedLspRequest.Builder {
private boolean bIsSRPObjectSet = false;
private boolean bIsLSPObjectSet = false;
private boolean bIsSrpObjectSet = false;
private boolean bIsLspObjectSet = false;
private boolean bIsEndPointsObjectSet = false;
private boolean bIsEROObjectSet = false;
private boolean bIsEroObjectSet = false;
private boolean bIsPcepAttributeSet = false;
private boolean bIsbRFlagSet = false;
......@@ -178,7 +178,7 @@ public class PcInitiatedLspRequestVer1 implements PcInitiatedLspRequest {
PcepAttribute pcepAttribute = null;
boolean bRFlag = false;
if (!this.bIsSRPObjectSet) {
if (!this.bIsSrpObjectSet) {
throw new PcepParseException("Srp object NOT Set while building PcInitiatedLspRequest");
} else {
srpObject = this.srpObject;
......@@ -191,7 +191,7 @@ public class PcInitiatedLspRequestVer1 implements PcInitiatedLspRequest {
this.bIsbRFlagSet = false;
}
if (!this.bIsLSPObjectSet) {
if (!this.bIsLspObjectSet) {
throw new PcepParseException("LSP Object NOT Set while building PcInitiatedLspRequest");
} else {
lspObject = this.lspObject;
......@@ -203,7 +203,7 @@ public class PcInitiatedLspRequestVer1 implements PcInitiatedLspRequest {
} else {
endPointsObject = this.endPointsObject;
}
if (!this.bIsEROObjectSet) {
if (!this.bIsEroObjectSet) {
throw new PcepParseException("ERO Object NOT Set while building PcInitiatedLspRequest");
} else {
eroObject = this.eroObject;
......@@ -243,7 +243,7 @@ public class PcInitiatedLspRequestVer1 implements PcInitiatedLspRequest {
@Override
public Builder setSrpObject(PcepSrpObject srpobj) {
this.srpObject = srpobj;
this.bIsSRPObjectSet = true;
this.bIsSrpObjectSet = true;
return this;
}
......@@ -251,7 +251,7 @@ public class PcInitiatedLspRequestVer1 implements PcInitiatedLspRequest {
@Override
public Builder setLspObject(PcepLspObject lspObject) {
this.lspObject = lspObject;
this.bIsLSPObjectSet = true;
this.bIsLspObjectSet = true;
return this;
}
......@@ -265,7 +265,7 @@ public class PcInitiatedLspRequestVer1 implements PcInitiatedLspRequest {
@Override
public Builder setEroObject(PcepEroObject eroObject) {
this.eroObject = eroObject;
this.bIsEROObjectSet = true;
this.bIsEroObjectSet = true;
return this;
}
......
......@@ -236,7 +236,7 @@ public class PcepLabelUpdateVer1 implements PcepLabelUpdate {
default:
throw new PcepParseException("Unkown FEC object type " + tempObjHeader.getObjType());
}
labelMap.setFECObject(fecObject);
labelMap.setFecObject(fecObject);
pceLabelUpdate.setLabelMap(labelMap);
} else {
throw new PcepParseException(
......@@ -308,7 +308,7 @@ public class PcepLabelUpdateVer1 implements PcepLabelUpdate {
} else {
labelObject.write(cb);
}
fecObject = labelMap.getFECObject();
fecObject = labelMap.getFecObject();
if (fecObject == null) {
throw new PcepParseException("fec Object is mandatory object for Label map.");
} else {
......
......@@ -121,7 +121,7 @@ public class PcepMsgPathVer1 implements PcepMsgPath {
*/
public static class Builder implements PcepMsgPath.Builder {
private boolean bIsEROObjectSet = false;
private boolean bIsEroObjectSet = false;
private boolean bIsPcepAttributeSet = false;
//PCEP ERO Object
......@@ -137,7 +137,7 @@ public class PcepMsgPathVer1 implements PcepMsgPath {
//PCEP Attribute list
PcepAttribute pcepAttribute = null;
if (!this.bIsEROObjectSet) {
if (!this.bIsEroObjectSet) {
throw new PcepParseException("ERO Object NOT Set while building PcepMsgPath.");
} else {
eroObject = this.eroObject;
......@@ -164,7 +164,7 @@ public class PcepMsgPathVer1 implements PcepMsgPath {
@Override
public Builder setEroObject(PcepEroObject eroObject) {
this.eroObject = eroObject;
this.bIsEROObjectSet = true;
this.bIsEroObjectSet = true;
return this;
}
......
......@@ -333,8 +333,8 @@ public class PcepStateReportVer1 implements PcepStateReport {
*/
public static class Builder implements PcepStateReport.Builder {
private boolean bIsSRPObjectSet = false;
private boolean bIsLSPObjectSet = false;
private boolean bIsSrpObjectSet = false;
private boolean bIsLspObjectSet = false;
private boolean bIsPcepMsgPathSet = false;
//PCEP SRP Object
......@@ -354,11 +354,11 @@ public class PcepStateReportVer1 implements PcepStateReport {
//PCEP Attribute list
PcepStateReport.PcepMsgPath msgPath = null;
if (this.bIsSRPObjectSet) {
if (this.bIsSrpObjectSet) {
srpObject = this.srpObject;
}
if (!this.bIsLSPObjectSet) {
if (!this.bIsLspObjectSet) {
throw new PcepParseException(" LSP Object NOT Set while building PcepStateReport.");
} else {
lspObject = this.lspObject;
......@@ -390,14 +390,14 @@ public class PcepStateReportVer1 implements PcepStateReport {
@Override
public Builder setSrpObject(PcepSrpObject srpobj) {
this.srpObject = srpobj;
this.bIsSRPObjectSet = true;
this.bIsSrpObjectSet = true;
return this;
}
@Override
public Builder setLspObject(PcepLspObject lspObject) {
this.lspObject = lspObject;
this.bIsLSPObjectSet = true;
this.bIsLspObjectSet = true;
return this;
}
......
......@@ -110,8 +110,8 @@ public class PcepUpdateRequestVer1 implements PcepUpdateRequest {
*/
public static class Builder implements PcepUpdateRequest.Builder {
private boolean bIsSRPObjectSet = false;
private boolean bIsLSPObjectSet = false;
private boolean bIsSrpObjectSet = false;
private boolean bIsLspObjectSet = false;
private boolean bIsPcepMsgPathSet = false;
//PCEP SRP Object
......@@ -131,12 +131,12 @@ public class PcepUpdateRequestVer1 implements PcepUpdateRequest {
//PCEP Attribute list
PcepMsgPath msgPath = null;
if (!this.bIsSRPObjectSet) {
if (!this.bIsSrpObjectSet) {
throw new PcepParseException(" SRP Object NOT Set while building PcepUpdateRequest.");
} else {
srpObject = this.srpObject;
}
if (!this.bIsLSPObjectSet) {
if (!this.bIsLspObjectSet) {
throw new PcepParseException(" LSP Object NOT Set while building PcepUpdateRequest.");
} else {
lspObject = this.lspObject;
......@@ -168,7 +168,7 @@ public class PcepUpdateRequestVer1 implements PcepUpdateRequest {
@Override
public Builder setSrpObject(PcepSrpObject srpobj) {
this.srpObject = srpobj;
this.bIsSRPObjectSet = true;
this.bIsSrpObjectSet = true;
return this;
}
......@@ -176,7 +176,7 @@ public class PcepUpdateRequestVer1 implements PcepUpdateRequest {
@Override
public Builder setLspObject(PcepLspObject lspObject) {
this.lspObject = lspObject;
this.bIsLSPObjectSet = true;
this.bIsLspObjectSet = true;
return this;
}
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides BGP LS identifier which contains opaque value (32 Bit ID).
*/
public class BGPLSidentifierTlv implements PcepValueType {
public class BgpLsIdentifierTlv implements PcepValueType {
/* Reference :draft-ietf-idr-ls-distribution-10
* 0 1 2 3
......@@ -39,7 +39,7 @@ public class BGPLSidentifierTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(BGPLSidentifierTlv.class);
protected static final Logger log = LoggerFactory.getLogger(BgpLsIdentifierTlv.class);
public static final short TYPE = 17; //TODD:change this TBD11
public static final short LENGTH = 4;
......@@ -51,7 +51,7 @@ public class BGPLSidentifierTlv implements PcepValueType {
*
* @param rawValue BGP LS identifier Tlv
*/
public BGPLSidentifierTlv(int rawValue) {
public BgpLsIdentifierTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -61,8 +61,8 @@ public class BGPLSidentifierTlv implements PcepValueType {
* @param raw value
* @return object of BGPLSidentifierTlv
*/
public static BGPLSidentifierTlv of(final int raw) {
return new BGPLSidentifierTlv(raw);
public static BgpLsIdentifierTlv of(final int raw) {
return new BgpLsIdentifierTlv(raw);
}
/**
......@@ -99,8 +99,8 @@ public class BGPLSidentifierTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof BGPLSidentifierTlv) {
BGPLSidentifierTlv other = (BGPLSidentifierTlv) obj;
if (obj instanceof BgpLsIdentifierTlv) {
BgpLsIdentifierTlv other = (BgpLsIdentifierTlv) obj;
return Objects.equals(rawValue, other.rawValue);
}
return false;
......@@ -121,8 +121,8 @@ public class BGPLSidentifierTlv implements PcepValueType {
* @param c input channel buffer
* @return object of BGP LS identifier Tlv
*/
public static BGPLSidentifierTlv read(ChannelBuffer c) {
return BGPLSidentifierTlv.of(c.readInt());
public static BgpLsIdentifierTlv read(ChannelBuffer c) {
return BgpLsIdentifierTlv.of(c.readInt());
}
@Override
......
......@@ -15,15 +15,14 @@
*/
package org.onosproject.pcepio.types;
import java.util.Arrays;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Arrays;
/**
* Provides IPv6 Interface Address. REFERENCE :[RFC6119]/4.2.
......@@ -65,15 +64,15 @@ public class IPv6InterfaceAddressTlv implements PcepValueType {
*/
public static IPv6InterfaceAddressTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNONE = true;
boolean bFoundNone = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
if (NONE_VAL[i] != raw[i]) {
bFoundNONE = false;
bFoundNone = false;
}
}
if (bFoundNONE) {
if (bFoundNone) {
return NONE;
}
......
......@@ -15,15 +15,14 @@
*/
package org.onosproject.pcepio.types;
import java.util.Arrays;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Arrays;
/**
* Provides IPv6 Neighbor Address. Reference :[RFC6119]/4.3.
......@@ -63,15 +62,15 @@ public class IPv6NeighborAddressTlv implements PcepValueType {
*/
public static IPv6NeighborAddressTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNONE = true;
boolean bFoundNone = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
if (NONE_VAL[i] != raw[i]) {
bFoundNONE = false;
bFoundNone = false;
}
}
if (bFoundNONE) {
if (bFoundNone) {
return NONE;
}
......
......@@ -16,15 +16,14 @@
package org.onosproject.pcepio.types;
import java.util.Arrays;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Arrays;
/**
* Provides IPv6 Sub Object.
......@@ -115,15 +114,15 @@ public class IPv6SubObject implements PcepValueType {
*/
public static IPv6SubObject of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNONE = true;
boolean bFoundNone = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
if (NONE_VAL[i] != raw[i]) {
bFoundNONE = false;
bFoundNone = false;
}
}
if (bFoundNONE) {
if (bFoundNone) {
return NONE;
}
......
......@@ -15,15 +15,14 @@
*/
package org.onosproject.pcepio.types;
import java.util.Arrays;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Arrays;
/**
* Provides IPv6 TE Router Id of Local Node. Reference :[RFC6119]/4.1.
......@@ -63,15 +62,15 @@ public class IPv6TERouterIdofLocalNodeTlv implements PcepValueType {
*/
public static IPv6TERouterIdofLocalNodeTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNONE = true;
boolean bFoundNone = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
if (NONE_VAL[i] != raw[i]) {
bFoundNONE = false;
bFoundNone = false;
}
}
if (bFoundNONE) {
if (bFoundNone) {
return NONE;
}
......
......@@ -15,15 +15,14 @@
*/
package org.onosproject.pcepio.types;
import java.util.Arrays;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Arrays;
/**
* Provides IPv6 TE Router Id of Remote Node. Reference :[RFC6119]/4.1.
......@@ -64,15 +63,15 @@ public class IPv6TERouterIdofRemoteNodeTlv implements PcepValueType {
*/
public static IPv6TERouterIdofRemoteNodeTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNONE = true;
boolean bFoundNone = true;
//value starts from 3rd byte.
for (int i = 2; i < 20; ++i) {
if (NONE_VAL[i] != raw[i]) {
bFoundNONE = false;
bFoundNone = false;
}
}
if (bFoundNONE) {
if (bFoundNone) {
return NONE;
}
......
......@@ -15,20 +15,19 @@
*/
package org.onosproject.pcepio.types;
import java.util.Arrays;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Arrays;
/**
* Provides IGP Link Metric .
*/
public class IGPMetricTlv implements PcepValueType {
public class IgpMetricTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr-ls-distribution] /3.3.2.4
* 0 1 2 3
......@@ -40,7 +39,7 @@ public class IGPMetricTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(IGPMetricTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IgpMetricTlv.class);
public static final short TYPE = 1095; //TODO:NEED TO HANDLE TDB40
private short hLength;
......@@ -53,7 +52,7 @@ public class IGPMetricTlv implements PcepValueType {
* @param rawValue IGP Link Metric
* @param hLength length
*/
public IGPMetricTlv(byte[] rawValue, short hLength) {
public IgpMetricTlv(byte[] rawValue, short hLength) {
this.rawValue = rawValue;
this.hLength = hLength;
}
......@@ -65,8 +64,8 @@ public class IGPMetricTlv implements PcepValueType {
* @param hLength length
* @return object of IGPMetricTlv
*/
public static IGPMetricTlv of(final byte[] raw, short hLength) {
return new IGPMetricTlv(raw, hLength);
public static IgpMetricTlv of(final byte[] raw, short hLength) {
return new IgpMetricTlv(raw, hLength);
}
/**
......@@ -103,8 +102,8 @@ public class IGPMetricTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof IGPMetricTlv) {
IGPMetricTlv other = (IGPMetricTlv) obj;
if (obj instanceof IgpMetricTlv) {
IgpMetricTlv other = (IgpMetricTlv) obj;
return Arrays.equals(rawValue, other.rawValue);
}
return false;
......@@ -127,9 +126,9 @@ public class IGPMetricTlv implements PcepValueType {
* @return object of IGPMetricTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iIGPMetric = new byte[hLength];
c.readBytes(iIGPMetric, 0, hLength);
return new IGPMetricTlv(iIGPMetric, hLength);
byte[] iIgpMetric = new byte[hLength];
c.readBytes(iIgpMetric, 0, hLength);
return new IgpMetricTlv(iIgpMetric, hLength);
}
@Override
......
......@@ -15,21 +15,20 @@
*/
package org.onosproject.pcepio.types;
import java.util.Arrays;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Arrays;
import java.util.Objects;
/**
* Provides ISIS Area Identifier.
*/
public class ISISAreaIdentifierTlv implements PcepValueType {
public class IsisAreaIdentifierTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr- ls-distribution]/3.3.1.2
* 0 1 2 3
......@@ -41,7 +40,7 @@ public class ISISAreaIdentifierTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(ISISAreaIdentifierTlv.class);
protected static final Logger log = LoggerFactory.getLogger(IsisAreaIdentifierTlv.class);
public static final short TYPE = 107; //TODO:NEED TO HANDLE TBD24
private short hLength;
......@@ -54,7 +53,7 @@ public class ISISAreaIdentifierTlv implements PcepValueType {
* @param rawValue ISIS-Area-Identifier
* @param hLength length
*/
public ISISAreaIdentifierTlv(byte[] rawValue, short hLength) {
public IsisAreaIdentifierTlv(byte[] rawValue, short hLength) {
log.debug("ISISAreaIdentifierTlv");
this.rawValue = rawValue;
if (0 == hLength) {
......@@ -71,8 +70,8 @@ public class ISISAreaIdentifierTlv implements PcepValueType {
* @param hLength length
* @return object of ISISAreaIdentifierTlv
*/
public static ISISAreaIdentifierTlv of(final byte[] raw, short hLength) {
return new ISISAreaIdentifierTlv(raw, hLength);
public static IsisAreaIdentifierTlv of(final byte[] raw, short hLength) {
return new IsisAreaIdentifierTlv(raw, hLength);
}
/**
......@@ -109,8 +108,8 @@ public class ISISAreaIdentifierTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof ISISAreaIdentifierTlv) {
ISISAreaIdentifierTlv other = (ISISAreaIdentifierTlv) obj;
if (obj instanceof IsisAreaIdentifierTlv) {
IsisAreaIdentifierTlv other = (IsisAreaIdentifierTlv) obj;
return Objects.equals(hLength, other.hLength) && Arrays.equals(rawValue, other.rawValue);
}
return false;
......@@ -133,9 +132,9 @@ public class ISISAreaIdentifierTlv implements PcepValueType {
* @return object of ISISAreaIdentifierTlv
*/
public static PcepValueType read(ChannelBuffer c, short hLength) {
byte[] iISISAreaIdentifier = new byte[hLength];
c.readBytes(iISISAreaIdentifier, 0, hLength);
return new ISISAreaIdentifierTlv(iISISAreaIdentifier, hLength);
byte[] iIsisAreaIdentifier = new byte[hLength];
c.readBytes(iIsisAreaIdentifier, 0, hLength);
return new IsisAreaIdentifierTlv(iIsisAreaIdentifier, hLength);
}
@Override
......
......@@ -201,13 +201,13 @@ public class LocalTENodeDescriptorsTlv implements PcepValueType {
iValue = tempCb.readInt();
tlv = new AutonomousSystemTlv(iValue);
break;
case BGPLSidentifierTlv.TYPE:
case BgpLsIdentifierTlv.TYPE:
iValue = tempCb.readInt();
tlv = new BGPLSidentifierTlv(iValue);
tlv = new BgpLsIdentifierTlv(iValue);
break;
case OSPFareaIDsubTlv.TYPE:
case OspfAreaIdSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new OSPFareaIDsubTlv(iValue);
tlv = new OspfAreaIdSubTlv(iValue);
break;
case RouterIDSubTlv.TYPE:
tlv = RouterIDSubTlv.read(tempCb, length);
......
......@@ -27,7 +27,7 @@ import com.google.common.base.MoreObjects;
/**
* Provides MPLS Protocol Mask.
*/
public class MPLSProtocolMaskTlv implements PcepValueType {
public class MplsProtocolMaskTlv implements PcepValueType {
/* Reference :[I-D.ietf-idr-ls-distribution]/3.3.2.2
* 0 1 2 3
......@@ -38,7 +38,7 @@ public class MPLSProtocolMaskTlv implements PcepValueType {
|L|R| Reserved |
+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(MPLSProtocolMaskTlv.class);
protected static final Logger log = LoggerFactory.getLogger(MplsProtocolMaskTlv.class);
public static final short TYPE = 1094; //TDB39
public static final short LENGTH = 1;
......@@ -55,7 +55,7 @@ public class MPLSProtocolMaskTlv implements PcepValueType {
*
* @param rawValue MPLS Protocol Mask Flag Bits
*/
public MPLSProtocolMaskTlv(byte rawValue) {
public MplsProtocolMaskTlv(byte rawValue) {
this.rawValue = rawValue;
this.isRawValueSet = true;
this.bLFlag = (rawValue & LFLAG_SET) == LFLAG_SET;
......@@ -68,7 +68,7 @@ public class MPLSProtocolMaskTlv implements PcepValueType {
* @param bLFlag L-flag
* @param bRFlag R-flag
*/
public MPLSProtocolMaskTlv(boolean bLFlag, boolean bRFlag) {
public MplsProtocolMaskTlv(boolean bLFlag, boolean bRFlag) {
this.bLFlag = bLFlag;
this.bRFlag = bRFlag;
this.rawValue = 0;
......@@ -81,8 +81,8 @@ public class MPLSProtocolMaskTlv implements PcepValueType {
* @param raw MPLS Protocol Mask Tlv
* @return new object of MPLS Protocol Mask Tlv
*/
public static MPLSProtocolMaskTlv of(final byte raw) {
return new MPLSProtocolMaskTlv(raw);
public static MplsProtocolMaskTlv of(final byte raw) {
return new MplsProtocolMaskTlv(raw);
}
/**
......@@ -141,8 +141,8 @@ public class MPLSProtocolMaskTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof MPLSProtocolMaskTlv) {
MPLSProtocolMaskTlv other = (MPLSProtocolMaskTlv) obj;
if (obj instanceof MplsProtocolMaskTlv) {
MplsProtocolMaskTlv other = (MplsProtocolMaskTlv) obj;
if (isRawValueSet) {
return Objects.equals(this.rawValue, other.rawValue);
} else {
......@@ -186,7 +186,7 @@ public class MPLSProtocolMaskTlv implements PcepValueType {
bLFlag = (temp & LFLAG_SET) == LFLAG_SET;
bRFlag = (temp & RFLAG_SET) == RFLAG_SET;
return new MPLSProtocolMaskTlv(bLFlag, bRFlag);
return new MplsProtocolMaskTlv(bLFlag, bRFlag);
}
@Override
......
......@@ -16,15 +16,14 @@
package org.onosproject.pcepio.types;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.util.Objects;
/**
* NexthopIPv6addressTlv provides Ipv6 address of next hop.
......@@ -84,15 +83,15 @@ public class NexthopIPv6addressTlv implements PcepValueType {
//logic to be checked
public static NexthopIPv6addressTlv of(final byte[] raw) {
//check NONE_VAL
boolean bFoundNONE = true;
boolean bFoundNone = true;
//value starts from 3rd byte.
for (int i = 5; i < 20; ++i) {
if (NONE_VAL[i] != raw[i]) {
bFoundNONE = false;
bFoundNone = false;
}
}
if (bFoundNONE) {
if (bFoundNone) {
return NONE;
}
......
......@@ -15,18 +15,18 @@
*/
package org.onosproject.pcepio.types;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import java.util.Objects;
/**
* Provides area ID for OSPF area.
*/
public class OSPFareaIDsubTlv implements PcepValueType {
public class OspfAreaIdSubTlv implements PcepValueType {
/* Reference :draft-ietf-idr-ls-distribution-10.
* 0 1 2 3
......@@ -38,7 +38,7 @@ public class OSPFareaIDsubTlv implements PcepValueType {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
protected static final Logger log = LoggerFactory.getLogger(OSPFareaIDsubTlv.class);
protected static final Logger log = LoggerFactory.getLogger(OspfAreaIdSubTlv.class);
public static final short TYPE = 600; //TODD:change this TBD12
public static final short LENGTH = 4;
......@@ -50,7 +50,7 @@ public class OSPFareaIDsubTlv implements PcepValueType {
*
* @param rawValue area ID for OSPF area.
*/
public OSPFareaIDsubTlv(int rawValue) {
public OspfAreaIdSubTlv(int rawValue) {
this.rawValue = rawValue;
}
......@@ -60,8 +60,8 @@ public class OSPFareaIDsubTlv implements PcepValueType {
* @param raw opaque value of AreaID
* @return new object of OSPF area ID sub TLV
*/
public static OSPFareaIDsubTlv of(final int raw) {
return new OSPFareaIDsubTlv(raw);
public static OspfAreaIdSubTlv of(final int raw) {
return new OspfAreaIdSubTlv(raw);
}
/**
......@@ -98,8 +98,8 @@ public class OSPFareaIDsubTlv implements PcepValueType {
if (this == obj) {
return true;
}
if (obj instanceof OSPFareaIDsubTlv) {
OSPFareaIDsubTlv other = (OSPFareaIDsubTlv) obj;
if (obj instanceof OspfAreaIdSubTlv) {
OspfAreaIdSubTlv other = (OspfAreaIdSubTlv) obj;
return Objects.equals(this.rawValue, other.rawValue);
}
return false;
......@@ -120,8 +120,8 @@ public class OSPFareaIDsubTlv implements PcepValueType {
* @param c input channel buffer
* @return object of OSPFAreaIdSubTlv
*/
public static OSPFareaIDsubTlv read(ChannelBuffer c) {
return OSPFareaIDsubTlv.of(c.readInt());
public static OspfAreaIdSubTlv read(ChannelBuffer c) {
return OspfAreaIdSubTlv.of(c.readInt());
}
@Override
......
......@@ -43,7 +43,7 @@ public class PcepLabelMap {
*
* @param fecObject PCEP fec object
*/
public void setFECObject(PcepFecObject fecObject) {
public void setFecObject(PcepFecObject fecObject) {
this.fecObject = fecObject;
}
......@@ -52,7 +52,7 @@ public class PcepLabelMap {
*
* @return PCEP fec object
*/
public PcepFecObject getFECObject() {
public PcepFecObject getFecObject() {
return this.fecObject;
}
......
......@@ -204,13 +204,13 @@ public class RemoteTENodeDescriptorsTlv implements PcepValueType {
iValue = tempCb.readInt();
tlv = new AutonomousSystemTlv(iValue);
break;
case BGPLSidentifierTlv.TYPE:
case BgpLsIdentifierTlv.TYPE:
iValue = tempCb.readInt();
tlv = new BGPLSidentifierTlv(iValue);
tlv = new BgpLsIdentifierTlv(iValue);
break;
case OSPFareaIDsubTlv.TYPE:
case OspfAreaIdSubTlv.TYPE:
iValue = tempCb.readInt();
tlv = new OSPFareaIDsubTlv(iValue);
tlv = new OspfAreaIdSubTlv(iValue);
break;
case RouterIDSubTlv.TYPE:
tlv = RouterIDSubTlv.read(tempCb, hLength);
......
......@@ -16,15 +16,14 @@
package org.onosproject.pcepio.types;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.jboss.netty.buffer.ChannelBuffer;
import org.onosproject.pcepio.protocol.PcepNai;
import org.onosproject.pcepio.protocol.PcepVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.MoreObjects;
import java.util.Objects;
/**
* Provides SrEroSubObject.
......@@ -185,7 +184,7 @@ public class SrEroSubObject implements PcepValueType {
* Returns sID.
* @return sID
*/
public int getSID() {
public int getSid() {
return sID;
}
......
......@@ -242,12 +242,12 @@ public class TELinkAttributesTlv implements PcepValueType {
case LinkProtectionTypeTlv.TYPE:
tlv = LinkProtectionTypeTlv.read(tempCb);
break;
case MPLSProtocolMaskTlv.TYPE:
case MplsProtocolMaskTlv.TYPE:
byte cValue = tempCb.readByte();
tlv = new MPLSProtocolMaskTlv(cValue);
tlv = new MplsProtocolMaskTlv(cValue);
break;
case IGPMetricTlv.TYPE:
tlv = IGPMetricTlv.read(tempCb, length);
case IgpMetricTlv.TYPE:
tlv = IgpMetricTlv.read(tempCb, length);
break;
case SharedRiskLinkGroupTlv.TYPE:
tlv = SharedRiskLinkGroupTlv.read(tempCb, length);
......
......@@ -204,8 +204,8 @@ public class TENodeAttributesTlv implements PcepValueType {
case NodeNameTlv.TYPE:
tlv = NodeNameTlv.read(tempCb, length);
break;
case ISISAreaIdentifierTlv.TYPE:
tlv = ISISAreaIdentifierTlv.read(tempCb, length);
case IsisAreaIdentifierTlv.TYPE:
tlv = IsisAreaIdentifierTlv.read(tempCb, length);
break;
case IPv4TERouterIdOfLocalNodeTlv.TYPE:
iValue = tempCb.readInt();
......
......@@ -21,10 +21,10 @@ import org.junit.Test;
/**
* Test of the BGPLSidentifierTlv.
*/
public class BGPLSidentifierTlvTest {
private final BGPLSidentifierTlv tlv1 = BGPLSidentifierTlv.of(1);
private final BGPLSidentifierTlv sameAsTlv1 = BGPLSidentifierTlv.of(1);
private final BGPLSidentifierTlv tlv2 = BGPLSidentifierTlv.of(2);
public class BgpLsIdentifierTlvTest {
private final BgpLsIdentifierTlv tlv1 = BgpLsIdentifierTlv.of(1);
private final BgpLsIdentifierTlv sameAsTlv1 = BgpLsIdentifierTlv.of(1);
private final BgpLsIdentifierTlv tlv2 = BgpLsIdentifierTlv.of(2);
@Test
public void basics() {
......
......@@ -21,12 +21,12 @@ import org.junit.Test;
/**
* Test of the IGPMetricTlv.
*/
public class IGPMetricTlvTest {
public class IgpMetricTlvTest {
private final byte[] b1 = new byte[] {0x01, 0x02};
private final byte[] b2 = new byte[] {0x01, 0x03};
private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2);
private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2);
private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2);
private final IgpMetricTlv tlv1 = IgpMetricTlv.of(b1, (short) 2);
private final IgpMetricTlv sameAsTlv1 = IgpMetricTlv.of(b1, (short) 2);
private final IgpMetricTlv tlv2 = IgpMetricTlv.of(b2, (short) 2);
@Test
public void basics() {
......
......@@ -21,14 +21,14 @@ import org.junit.Test;
/**
* Test of the ISISAreaIdentifierTlv.
*/
public class ISISAreaIdentifierTlvTest {
public class IsisAreaIdentifierTlvTest {
private final byte[] b1 = new byte[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
private final byte[] b2 = new byte[] {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
private final ISISAreaIdentifierTlv tlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20);
private final ISISAreaIdentifierTlv sameAsTlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20);
private final ISISAreaIdentifierTlv tlv2 = ISISAreaIdentifierTlv.of(b2, (short) 20);
private final IsisAreaIdentifierTlv tlv1 = IsisAreaIdentifierTlv.of(b1, (short) 20);
private final IsisAreaIdentifierTlv sameAsTlv1 = IsisAreaIdentifierTlv.of(b1, (short) 20);
private final IsisAreaIdentifierTlv tlv2 = IsisAreaIdentifierTlv.of(b2, (short) 20);
@Test
public void basics() {
......
......@@ -26,10 +26,10 @@ import java.util.LinkedList;
public class LocalTENodeDescriptorsTlvTest {
private final AutonomousSystemTlv baAutoSysTlvRawValue1 = new AutonomousSystemTlv(1);
private final BGPLSidentifierTlv baBgplsIdRawValue1 = new BGPLSidentifierTlv(1);
private final BgpLsIdentifierTlv baBgplsIdRawValue1 = new BgpLsIdentifierTlv(1);
private final AutonomousSystemTlv baAutoSysTlvRawValue2 = new AutonomousSystemTlv(2);
private final BGPLSidentifierTlv baBgplsIdRawValue2 = new BGPLSidentifierTlv(2);
private final BgpLsIdentifierTlv baBgplsIdRawValue2 = new BgpLsIdentifierTlv(2);
private final LinkedList<PcepValueType> llNodeDescriptorSubTLVs1 = new LinkedList<PcepValueType>();
private final boolean a = llNodeDescriptorSubTLVs1.add(baAutoSysTlvRawValue1);
......
......@@ -21,13 +21,13 @@ import org.junit.Test;
/**
* Test of the MPLSProtocolMaskTlv.
*/
public class MPLSProtocolMaskTlvTest {
public class MplsProtocolMaskTlvTest {
private final byte rawValue1 = 0x0A;
private final byte rawValue2 = 0x0B;
private final MPLSProtocolMaskTlv tlv1 = new MPLSProtocolMaskTlv(rawValue1);
private final MPLSProtocolMaskTlv sameAsTlv1 = new MPLSProtocolMaskTlv(rawValue1);
private final MPLSProtocolMaskTlv tlv2 = MPLSProtocolMaskTlv.of(rawValue2);
private final MplsProtocolMaskTlv tlv1 = new MplsProtocolMaskTlv(rawValue1);
private final MplsProtocolMaskTlv sameAsTlv1 = new MplsProtocolMaskTlv(rawValue1);
private final MplsProtocolMaskTlv tlv2 = MplsProtocolMaskTlv.of(rawValue2);
@Test
public void basics() {
......
......@@ -21,11 +21,11 @@ import org.junit.Test;
/**
* Test of the OSPFareaIDsubTlv.
*/
public class OSPFareaIDsubTlvTest {
public class OspfAreaIdSubTlvTest {
private final int rawValue1 = 0x0A;
private final OSPFareaIDsubTlv tlv1 = new OSPFareaIDsubTlv(rawValue1);
private final OSPFareaIDsubTlv tlv2 = OSPFareaIDsubTlv.of(tlv1.getInt());
private final OspfAreaIdSubTlv tlv1 = new OspfAreaIdSubTlv(rawValue1);
private final OspfAreaIdSubTlv tlv2 = OspfAreaIdSubTlv.of(tlv1.getInt());
@Test
public void basics() {
......
......@@ -26,10 +26,10 @@ import java.util.LinkedList;
public class RemoteTENodeDescriptorsTlvTest {
private final AutonomousSystemTlv autonomousSystemTlv1 = new AutonomousSystemTlv(10);
private final BGPLSidentifierTlv bGPLSidentifierTlv1 = new BGPLSidentifierTlv(20);
private final BgpLsIdentifierTlv bGPLSidentifierTlv1 = new BgpLsIdentifierTlv(20);
private final AutonomousSystemTlv autonomousSystemTlv2 = new AutonomousSystemTlv(20);
private final BGPLSidentifierTlv bGPLSidentifierTlv2 = new BGPLSidentifierTlv(30);
private final BgpLsIdentifierTlv bGPLSidentifierTlv2 = new BgpLsIdentifierTlv(30);
private final LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLV1 = new LinkedList<>();
private final boolean a = llRemoteTENodeDescriptorSubTLV1.add(autonomousSystemTlv1);
......
......@@ -186,7 +186,7 @@ public class BgpTopologyProviderTest {
}
@Override
public void processBGPPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException {
public void processBgpPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException {
// TODO Auto-generated method stub
}
......
......@@ -278,7 +278,7 @@ public class PcepTopologyProvider extends AbstractProvider
}
@Override
public void handlePCEPlink(PcepLink link) {
public void handlePceplink(PcepLink link) {
OperationType operType = link.getOperationType();
LinkDescription ld = buildLinkDescription(link);
......
......@@ -15,24 +15,6 @@
*/
package org.onosproject.provider.pcep.tunnel.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onosproject.net.DefaultAnnotations.EMPTY;
import static org.onlab.util.Tools.get;
import static org.onosproject.net.DeviceId.deviceId;
import static org.onosproject.net.PortNumber.portNumber;
import static org.onosproject.pcep.api.PcepDpid.uri;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Optional;
import com.google.common.collect.Maps;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
......@@ -47,8 +29,8 @@ import org.onosproject.core.DefaultGroupId;
import org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint;
import org.onosproject.incubator.net.tunnel.DefaultTunnel;
import org.onosproject.incubator.net.tunnel.DefaultTunnelDescription;
import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
import org.onosproject.incubator.net.tunnel.DefaultTunnelStatistics;
import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
import org.onosproject.incubator.net.tunnel.OpticalLogicId;
import org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint;
import org.onosproject.incubator.net.tunnel.Tunnel;
......@@ -79,11 +61,10 @@ import org.onosproject.pcep.api.PcepDpid;
import org.onosproject.pcep.api.PcepHopNodeDescription;
import org.onosproject.pcep.api.PcepOperator.OperationType;
import org.onosproject.pcep.api.PcepTunnel;
import org.onosproject.pcep.api.PcepTunnel.PATHTYPE;
import org.onosproject.pcep.api.PcepTunnel.PathState;
import org.onosproject.pcep.api.PcepTunnel.PathType;
import org.onosproject.pcep.api.PcepTunnelListener;
import org.onosproject.pcep.api.PcepTunnelStatistics;
import org.osgi.service.component.annotations.Modified;
import org.onosproject.pcep.controller.PccId;
import org.onosproject.pcep.controller.PcepClient;
import org.onosproject.pcep.controller.PcepClientController;
......@@ -109,8 +90,27 @@ import org.onosproject.pcepio.types.IPv4SubObject;
import org.onosproject.pcepio.types.PcepValueType;
import org.onosproject.pcepio.types.StatefulIPv4LspIdentidiersTlv;
import org.onosproject.pcepio.types.SymbolicPathNameTlv;
import org.slf4j.Logger;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Modified;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Optional;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onlab.util.Tools.get;
import static org.onosproject.net.DefaultAnnotations.EMPTY;
import static org.onosproject.net.DeviceId.deviceId;
import static org.onosproject.net.PortNumber.portNumber;
import static org.onosproject.pcep.api.PcepDpid.uri;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provider which uses an PCEP controller to detect, update, create network
......@@ -156,7 +156,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
private InnerTunnelProvider listener = new InnerTunnelProvider();
protected PcepTunnelApiMapper pcepTunnelAPIMapper = new PcepTunnelApiMapper();
protected PcepTunnelApiMapper pcepTunnelApiMapper = new PcepTunnelApiMapper();
private static final int DEFAULT_BANDWIDTH_VALUE = 10;
/**
......@@ -174,7 +174,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
pcepClientController.addListener(listener);
pcepClientController.addEventListener(listener);
tunnelService.queryAllTunnels().forEach(tunnel -> {
String pcepTunnelId = getPCEPTunnelKey(tunnel.tunnelId());
String pcepTunnelId = getPcepTunnelKey(tunnel.tunnelId());
TunnelStatsCollector tsc = new TunnelStatsCollector(pcepTunnelId, tunnelStatsPollFrequency);
tsc.start();
collectors.put(tunnel.tunnelId().id(), tsc);
......@@ -373,7 +373,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
@Override
public TunnelId tunnelAdded(TunnelDescription tunnel) {
if (tunnel.type() == Tunnel.Type.MPLS) {
pcepTunnelAPIMapper.removeFromCoreTunnelRequestQueue(tunnel.id());
pcepTunnelApiMapper.removeFromCoreTunnelRequestQueue(tunnel.id());
return service.tunnelAdded(tunnel);
}
......@@ -419,7 +419,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
@Override
public void tunnelRemoved(TunnelDescription tunnel) {
if (tunnel.type() == Tunnel.Type.MPLS) {
pcepTunnelAPIMapper.removeFromCoreTunnelRequestQueue(tunnel.id());
pcepTunnelApiMapper.removeFromCoreTunnelRequestQueue(tunnel.id());
service.tunnelRemoved(tunnel);
}
......@@ -429,7 +429,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
error("Illegal tunnel type. Only support VLAN tunnel deletion.");
return;
}
String pcepTunnelId = getPCEPTunnelKey(tunnel.id());
String pcepTunnelId = getPcepTunnelKey(tunnel.id());
checkNotNull(pcepTunnelId, "The tunnel id is not exsited.");
if (!controller.deleteTunnel(pcepTunnelId)) {
error("Delete tunnel failed, Maybe some devices have been disconnected.");
......@@ -442,7 +442,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
@Override
public void tunnelUpdated(TunnelDescription tunnel) {
if (tunnel.type() == Tunnel.Type.MPLS) {
pcepTunnelAPIMapper.removeFromCoreTunnelRequestQueue(tunnel.id());
pcepTunnelApiMapper.removeFromCoreTunnelRequestQueue(tunnel.id());
service.tunnelUpdated(tunnel);
}
......@@ -457,7 +457,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
error("Update failed, invalid bandwidth.");
return;
}
String pcepTunnelId = getPCEPTunnelKey(tunnel.id());
String pcepTunnelId = getPcepTunnelKey(tunnel.id());
checkNotNull(pcepTunnelId, "Invalid tunnel id");
if (!controller.updateTunnelBandwidth(pcepTunnelId, bandwidth)) {
......@@ -490,7 +490,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
// Creates a path that leads through the given devices.
private Path createPath(List<PcepHopNodeDescription> hopList,
PATHTYPE pathtype, PathState pathState) {
PathType pathtype, PathState pathState) {
if (hopList == null || hopList.size() == 0) {
return null;
}
......@@ -627,7 +627,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
* @param tunnelId tunnel id
* @return corresponding a tunnel key of the tunnel id.
*/
private String getPCEPTunnelKey(TunnelId tunnelId) {
private String getPcepTunnelKey(TunnelId tunnelId) {
for (String key : tunnelMap.keySet()) {
if (tunnelMap.get(key).id() == tunnelId.id()) {
return key;
......@@ -760,7 +760,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
int srpId = SrpIdGenerators.create();
PcepTunnelData pcepTunnelData = new PcepTunnelData(tunnel, path, RequestType.CREATE);
pcepTunnelAPIMapper.addToCoreTunnelRequestQueue(pcepTunnelData);
pcepTunnelApiMapper.addToCoreTunnelRequestQueue(pcepTunnelData);
LinkedList<PcInitiatedLspRequest> llPcInitiatedLspRequestList = createPcInitiatedLspReqList(tunnel, path,
pc, srpId);
......@@ -776,7 +776,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
pc.sendMessage(Collections.singletonList(pcInitiateMsg));
pcepTunnelAPIMapper.addToTunnelRequestQueue(srpId, pcepTunnelData);
pcepTunnelApiMapper.addToTunnelRequestQueue(srpId, pcepTunnelData);
} catch (PcepParseException e) {
log.error("PcepParseException occurred while processing setup tunnel {}", e.getMessage());
}
......@@ -791,17 +791,17 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
private void pcepReleaseTunnel(Tunnel tunnel, PcepClient pc) {
try {
PcepTunnelData pcepTunnelData = new PcepTunnelData(tunnel, RequestType.DELETE);
pcepTunnelAPIMapper.addToCoreTunnelRequestQueue(pcepTunnelData);
pcepTunnelApiMapper.addToCoreTunnelRequestQueue(pcepTunnelData);
int srpId = SrpIdGenerators.create();
TunnelId tunnelId = tunnel.tunnelId();
int plspId = 0;
StatefulIPv4LspIdentidiersTlv statefulIpv4IndentifierTlv = null;
if (!(pcepTunnelAPIMapper.checkFromTunnelDBQueue(tunnelId))) {
if (!(pcepTunnelApiMapper.checkFromTunnelDBQueue(tunnelId))) {
log.error("Tunnel doesnot exists. Tunnel id {}" + tunnelId.toString());
return;
} else {
PcepTunnelData pcepTunnelDbData = pcepTunnelAPIMapper.getDataFromTunnelDBQueue(tunnelId);
PcepTunnelData pcepTunnelDbData = pcepTunnelApiMapper.getDataFromTunnelDBQueue(tunnelId);
plspId = pcepTunnelDbData.plspId();
statefulIpv4IndentifierTlv = pcepTunnelDbData.statefulIpv4IndentifierTlv();
}
......@@ -837,7 +837,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
pc.sendMessage(Collections.singletonList(pcInitiateMsg));
pcepTunnelAPIMapper.addToTunnelRequestQueue(srpId, pcepTunnelData);
pcepTunnelApiMapper.addToTunnelRequestQueue(srpId, pcepTunnelData);
} catch (PcepParseException e) {
log.error("PcepParseException occurred while processing release tunnel {}", e.getMessage());
}
......@@ -853,7 +853,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
private void pcepUpdateTunnel(Tunnel tunnel, Path path, PcepClient pc) {
try {
PcepTunnelData pcepTunnelData = new PcepTunnelData(tunnel, path, RequestType.UPDATE);
pcepTunnelAPIMapper.addToCoreTunnelRequestQueue(pcepTunnelData);
pcepTunnelApiMapper.addToCoreTunnelRequestQueue(pcepTunnelData);
int srpId = SrpIdGenerators.create();
TunnelId tunnelId = tunnel.tunnelId();
PcepValueType tlv;
......@@ -866,11 +866,11 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
//build SRP object
PcepSrpObject srpobj = pc.factory().buildSrpObject().setSrpID(srpId).setRFlag(false).build();
if (!(pcepTunnelAPIMapper.checkFromTunnelDBQueue(tunnelId))) {
if (!(pcepTunnelApiMapper.checkFromTunnelDBQueue(tunnelId))) {
log.error("Tunnel doesnot exists in DB");
return;
} else {
PcepTunnelData pcepTunnelDBData = pcepTunnelAPIMapper.getDataFromTunnelDBQueue(tunnelId);
PcepTunnelData pcepTunnelDBData = pcepTunnelApiMapper.getDataFromTunnelDBQueue(tunnelId);
plspId = pcepTunnelDBData.plspId();
}
......@@ -910,7 +910,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
PcepUpdateMsg pcUpdateMsg = pc.factory().buildUpdateMsg().setUpdateRequestList(llUpdateRequestList).build();
pc.sendMessage(Collections.singletonList(pcUpdateMsg));
pcepTunnelAPIMapper.addToTunnelRequestQueue(srpId, pcepTunnelData);
pcepTunnelApiMapper.addToTunnelRequestQueue(srpId, pcepTunnelData);
} catch (PcepParseException e) {
log.error("PcepParseException occurred while processing release tunnel {}", e.getMessage());
}
......@@ -921,7 +921,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
private class InnerTunnelProvider implements PcepTunnelListener, PcepEventListener, PcepClientListener {
@Override
public void handlePCEPTunnel(PcepTunnel pcepTunnel) {
public void handlePcepTunnel(PcepTunnel pcepTunnel) {
TunnelDescription tunnel = null;
// instance and id identify a tunnel together
String tunnelKey = String.valueOf(pcepTunnel.getInstance())
......@@ -981,7 +981,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
log.debug("Plsp ID in handle message " + lspObj.getPlspId());
log.debug("SRP ID in handle message " + srpId);
if (!(pcepTunnelAPIMapper.checkFromTunnelRequestQueue(srpId))) {
if (!(pcepTunnelApiMapper.checkFromTunnelRequestQueue(srpId))) {
// Check the sync status
if (lspObj.getSFlag()) {
......@@ -1013,7 +1013,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
*/
private void handleReportMessage(int srpId, PcepLspObject lspObj) {
ProviderId providerId = new ProviderId("pcep", PROVIDER_ID);
PcepTunnelData pcepTunnelData = pcepTunnelAPIMapper.getDataFromTunnelRequestQueue(srpId);
PcepTunnelData pcepTunnelData = pcepTunnelApiMapper.getDataFromTunnelRequestQueue(srpId);
SparseAnnotations annotations = (SparseAnnotations) pcepTunnelData.tunnel().annotations();
// store the values required from report message
......@@ -1045,7 +1045,7 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
if (RequestType.CREATE == pcepTunnelData.requestType()) {
log.debug("Report received for create request");
pcepTunnelAPIMapper.handleCreateTunnelRequestQueue(srpId, pcepTunnelData);
pcepTunnelApiMapper.handleCreateTunnelRequestQueue(srpId, pcepTunnelData);
if (0 == lspObj.getOFlag()) {
log.warn("The tunnel is in down state");
}
......@@ -1053,20 +1053,20 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
}
if (RequestType.DELETE == pcepTunnelData.requestType()) {
log.debug("Report received for delete request");
pcepTunnelAPIMapper.handleRemoveFromTunnelRequestQueue(srpId, pcepTunnelData);
pcepTunnelApiMapper.handleRemoveFromTunnelRequestQueue(srpId, pcepTunnelData);
tunnelRemoved(td);
}
if (RequestType.UPDATE == pcepTunnelData.requestType()) {
log.debug("Report received for update request");
pcepTunnelData.setRptFlag(true);
pcepTunnelAPIMapper.addToTunnelIdMap(pcepTunnelData);
pcepTunnelAPIMapper.handleUpdateTunnelRequestQueue(srpId, pcepTunnelData);
pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData);
pcepTunnelApiMapper.handleUpdateTunnelRequestQueue(srpId, pcepTunnelData);
if (0 == lspObj.getOFlag()) {
log.warn("The tunnel is in down state");
}
if (!(pcepTunnelAPIMapper.checkFromTunnelRequestQueue(srpId))) {
if (!(pcepTunnelApiMapper.checkFromTunnelRequestQueue(srpId))) {
tunnelUpdated(td);
}
}
......@@ -1207,8 +1207,8 @@ public class PcepTunnelProvider extends AbstractProvider implements TunnelProvid
PcepTunnelData pcepTunnelData = new PcepTunnelData(tunnel, path, RequestType.LSP_STATE_RPT);
pcepTunnelData.setStatefulIpv4IndentifierTlv(lspIdenTlv);
pcepTunnelAPIMapper.addPccTunnelDB(pcepTunnelData);
pcepTunnelAPIMapper.addToTunnelIdMap(pcepTunnelData);
pcepTunnelApiMapper.addPccTunnelDB(pcepTunnelData);
pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData);
}
@Override
......
......@@ -58,7 +58,7 @@ public class PcepReleaseTunnelProviderTest {
tunnelProvider.pcepClientController = controller;
tunnelProvider.controller = ctl;
tunnelProvider.tunnelService = tunnelService;
tunnelProvider.pcepTunnelAPIMapper = pcepTunnelAPIMapper;
tunnelProvider.pcepTunnelApiMapper = pcepTunnelAPIMapper;
tunnelProvider.cfgService = new ComponentConfigAdapter();
tunnelProvider.activate();
......@@ -99,9 +99,9 @@ public class PcepReleaseTunnelProviderTest {
pcepTunnelData.setPlspId(1);
StatefulIPv4LspIdentidiersTlv tlv = new StatefulIPv4LspIdentidiersTlv(0, (short) 1, (short) 2, 3, 4);
pcepTunnelData.setStatefulIpv4IndentifierTlv(tlv);
tunnelProvider.pcepTunnelAPIMapper.addToTunnelIdMap(pcepTunnelData);
tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData);
tunnelProvider.pcepTunnelAPIMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData);
tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData);
tunnelProvider.releaseTunnel(tunnel);
}
......
......@@ -58,7 +58,7 @@ public class PcepUpdateTunnelProviderTest {
tunnelProvider.tunnelProviderRegistry = registry;
tunnelProvider.pcepClientController = controller;
tunnelProvider.controller = ctl;
tunnelProvider.pcepTunnelAPIMapper = pcepTunnelAPIMapper;
tunnelProvider.pcepTunnelApiMapper = pcepTunnelAPIMapper;
tunnelProvider.cfgService = new ComponentConfigAdapter();
tunnelProvider.tunnelService = tunnelService;
tunnelProvider.activate();
......@@ -98,9 +98,9 @@ public class PcepUpdateTunnelProviderTest {
pcepTunnelData.setPlspId(1);
StatefulIPv4LspIdentidiersTlv tlv = new StatefulIPv4LspIdentidiersTlv(0, (short) 1, (short) 2, 3, 4);
pcepTunnelData.setStatefulIpv4IndentifierTlv(tlv);
tunnelProvider.pcepTunnelAPIMapper.addToTunnelIdMap(pcepTunnelData);
tunnelProvider.pcepTunnelApiMapper.addToTunnelIdMap(pcepTunnelData);
tunnelProvider.pcepTunnelAPIMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData);
tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData);
tunnelProvider.updateTunnel(tunnel, path);
}
......
......@@ -21,45 +21,42 @@ import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
import com.btisystems.pronx.ems.core.snmp.ISnmpSessionFactory;
import com.btisystems.pronx.ems.core.snmp.SnmpSessionFactory;
import com.btisystems.pronx.ems.core.snmp.V2cSnmpConfiguration;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.Sets;
import java.io.IOException;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Modified;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.incubator.net.faultmanagement.alarm.Alarm;
import org.onosproject.incubator.net.faultmanagement.alarm.AlarmEvent;
import org.onosproject.incubator.net.faultmanagement.alarm.AlarmListener;
import org.onosproject.incubator.net.faultmanagement.alarm.AlarmProvider;
import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
import org.onosproject.net.DeviceId;
import org.onosproject.net.device.DeviceEvent;
import org.onosproject.net.device.DeviceListener;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.provider.AbstractProvider;
import org.onosproject.net.provider.ProviderId;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.groupedThreads;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.incubator.net.faultmanagement.alarm.DefaultAlarm;
import org.onosproject.net.device.DeviceEvent;
import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED;
import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED;
import org.onosproject.net.device.DeviceListener;
import org.onosproject.net.device.DeviceService;
import static org.slf4j.LoggerFactory.getLogger;
/**
* SNMP alarms provider.
......@@ -145,8 +142,8 @@ public class SnmpAlarmProviderService extends AbstractProvider implements AlarmP
try (ISnmpSession session = getSessionFactory().createSession(config, ipAddress)) {
// Each session will be auto-closed.
String deviceOID = session.identifyDevice();
alarms.addAll(getAlarmsForDevice(deviceOID, session, deviceId));
String deviceOid = session.identifyDevice();
alarms.addAll(getAlarmsForDevice(deviceOid, session, deviceId));
log.info("SNMP walk completed ok for deviceId={}", deviceId);
} catch (IOException | RuntimeException ex) {
log.error("Failed to walk device.", ex.getMessage());
......@@ -177,11 +174,11 @@ public class SnmpAlarmProviderService extends AbstractProvider implements AlarmP
return sessionFactory;
}
private Collection<Alarm> getAlarmsForDevice(String deviceOID, ISnmpSession session,
private Collection<Alarm> getAlarmsForDevice(String deviceOid, ISnmpSession session,
DeviceId deviceID) throws IOException {
Collection<Alarm> alarms = new HashSet<>();
if (providers.containsKey(deviceOID)) {
alarms.addAll(providers.get(deviceOID).getAlarms(session, deviceID));
if (providers.containsKey(deviceOid)) {
alarms.addAll(providers.get(deviceOid).getAlarms(session, deviceID));
}
return alarms;
}
......
......@@ -22,23 +22,6 @@ import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
import com.btisystems.pronx.ems.core.snmp.ISnmpSessionFactory;
import com.btisystems.pronx.ems.core.snmp.SnmpSessionFactory;
import com.btisystems.pronx.ems.core.snmp.V2cSnmpConfiguration;
import static com.google.common.base.Strings.isNullOrEmpty;
import java.io.IOException;
import static org.onlab.util.Tools.delay;
import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
import static org.slf4j.LoggerFactory.getLogger;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
......@@ -63,6 +46,23 @@ import org.onosproject.net.provider.ProviderId;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import static com.google.common.base.Strings.isNullOrEmpty;
import static org.onlab.util.Tools.delay;
import static org.onlab.util.Tools.get;
import static org.onlab.util.Tools.groupedThreads;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Provider which will try to fetch the details of SNMP devices from the core and run a capability discovery on each of
* the device.
......@@ -374,10 +374,10 @@ public class SnmpDeviceProvider extends AbstractProvider
try (ISnmpSession session = sessionFactory.createSession(config, ipAddress)) {
// Each session will be auto-closed.
String deviceOID = session.identifyDevice();
String deviceOid = session.identifyDevice();
if (providers.containsKey(deviceOID)) {
desc = providers.get(deviceOID).populateDescription(session, desc);
if (providers.containsKey(deviceOid)) {
desc = providers.get(deviceOid).populateDescription(session, desc);
}
} catch (IOException | RuntimeException ex) {
......@@ -392,10 +392,10 @@ public class SnmpDeviceProvider extends AbstractProvider
* This will build a device id for the device.
*/
private DeviceId getDeviceId() throws URISyntaxException {
String additionalSSP = new StringBuilder(
String additionalSsp = new StringBuilder(
device.getSnmpHost()).append(":")
.append(device.getSnmpPort()).toString();
return DeviceId.deviceId(new URI(SCHEME, additionalSSP,
return DeviceId.deviceId(new URI(SCHEME, additionalSsp,
null));
}
}
......
......@@ -146,6 +146,9 @@
<property name="tagSeverity" value="error"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="allowedAbbreviationLength" value="2" />
</module>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
......
......@@ -28,6 +28,12 @@
<suppress files=".*" checks="OperatorWrapCheck"/>
<suppress files=".*" checks="HiddenField"/>
<suppress files=".java" checks="NewlineAtEndOfFile"/>
<suppress files="org.onlab.packet.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onlab.jdvue.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onosproject.driver.pipeline.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onosproject.igmp.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onosproject.pim.*" checks="AbbreviationAsWordInName" />
<suppress files="org.onosproject.segmentrouting.*" checks="AbbreviationAsWordInName" />
<!-- Suppressions for unit testing code -->
<suppress checks="JavadocPackage"
......