mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-12-16 14:52:15 +01:00
[ONOS-4687] GoldenEye - Label map download issues.
Change-Id: I5b56ccc6b8bad3c585f4d33ddd6d9094751c8797
This commit is contained in:
parent
8e9f8d1510
commit
fc10dca2dc
@ -893,9 +893,7 @@ public class PceManager implements PceService {
|
||||
|
||||
// Check whether device has SR-TE Capability
|
||||
if (cfg.labelStackCap()) {
|
||||
if (!srTeHandler.allocateNodeLabel(deviceId, lsrId)) {
|
||||
log.error("Node label allocation for a device id {} has failed.", deviceId.toString());
|
||||
}
|
||||
srTeHandler.allocateNodeLabel(deviceId, lsrId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -974,10 +972,7 @@ public class PceManager implements PceService {
|
||||
|
||||
// Check whether device has SR-TE Capability
|
||||
if (cfg.labelStackCap()) {
|
||||
if (!srTeHandler.allocateAdjacencyLabel(link)) {
|
||||
log.error("Unable to allocate adjacency label for a link {}.", link.toString());
|
||||
return;
|
||||
}
|
||||
srTeHandler.allocateAdjacencyLabel(link);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -1209,16 +1204,13 @@ public class PceManager implements PceService {
|
||||
if (cfg.labelStackCap()) {
|
||||
if (mastershipService.getLocalRole(deviceId) == MastershipRole.MASTER) {
|
||||
// Allocate node-label
|
||||
if (!srTeHandler.allocateNodeLabel(deviceId, lsrId)) {
|
||||
log.error("Node label allocation for a device id {} has failed.", deviceId.toString());
|
||||
}
|
||||
srTeHandler.allocateNodeLabel(deviceId, lsrId);
|
||||
|
||||
// Allocate adjacency label to links which are
|
||||
// originated from this specific device id
|
||||
Set<Link> links = linkService.getDeviceEgressLinks(deviceId);
|
||||
for (Link link : links) {
|
||||
if (!srTeHandler.allocateAdjacencyLabel(link)) {
|
||||
log.debug("Unable to allocate adjacency labels for a link {}.", link.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1240,40 +1232,42 @@ public class PceManager implements PceService {
|
||||
return false;
|
||||
}
|
||||
|
||||
Map<DeviceId, LabelResourceId> globalNodeLabelMap = pceStore.getGlobalNodeLabels();
|
||||
if (pceStore.getGlobalNodeLabel(deviceId) != null) {
|
||||
Map<DeviceId, LabelResourceId> globalNodeLabelMap = pceStore.getGlobalNodeLabels();
|
||||
|
||||
for (Entry<DeviceId, LabelResourceId> entry : globalNodeLabelMap.entrySet()) {
|
||||
for (Entry<DeviceId, LabelResourceId> entry : globalNodeLabelMap.entrySet()) {
|
||||
|
||||
// Convert from DeviceId to TunnelEndPoint
|
||||
Device srcDevice = deviceService.getDevice(entry.getKey());
|
||||
// Convert from DeviceId to TunnelEndPoint
|
||||
Device srcDevice = deviceService.getDevice(entry.getKey());
|
||||
|
||||
/*
|
||||
* If there is a slight difference in timing such that if device subsystem has removed the device but PCE
|
||||
* store still has it, just ignore such devices.
|
||||
*/
|
||||
if (srcDevice == null) {
|
||||
continue;
|
||||
/*
|
||||
* If there is a slight difference in timing such that if device subsystem has removed the device but
|
||||
* PCE store still has it, just ignore such devices.
|
||||
*/
|
||||
if (srcDevice == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String srcLsrId = srcDevice.annotations().value(LSRID);
|
||||
if (srcLsrId == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
srTeHandler.advertiseNodeLabelRule(deviceId,
|
||||
entry.getValue(),
|
||||
IpPrefix.valueOf(IpAddress.valueOf(srcLsrId), PREFIX_LENGTH),
|
||||
Objective.Operation.ADD, false);
|
||||
}
|
||||
|
||||
String srcLsrId = srcDevice.annotations().value(LSRID);
|
||||
if (srcLsrId == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
srTeHandler.advertiseNodeLabelRule(deviceId,
|
||||
entry.getValue(),
|
||||
IpPrefix.valueOf(IpAddress.valueOf(srcLsrId), PREFIX_LENGTH),
|
||||
Objective.Operation.ADD, false);
|
||||
}
|
||||
|
||||
Map<Link, LabelResourceId> adjLabelMap = pceStore.getAdjLabels();
|
||||
for (Entry<Link, LabelResourceId> entry : adjLabelMap.entrySet()) {
|
||||
if (entry.getKey().src().deviceId().equals(deviceId)) {
|
||||
srTeHandler.installAdjLabelRule(deviceId,
|
||||
entry.getValue(),
|
||||
entry.getKey().src().port(),
|
||||
entry.getKey().dst().port(),
|
||||
Objective.Operation.ADD);
|
||||
Map<Link, LabelResourceId> adjLabelMap = pceStore.getAdjLabels();
|
||||
for (Entry<Link, LabelResourceId> entry : adjLabelMap.entrySet()) {
|
||||
if (entry.getKey().src().deviceId().equals(deviceId)) {
|
||||
srTeHandler.installAdjLabelRule(deviceId,
|
||||
entry.getValue(),
|
||||
entry.getKey().src().port(),
|
||||
entry.getKey().dst().port(),
|
||||
Objective.Operation.ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,6 @@ import java.util.Set;
|
||||
import org.onlab.packet.IpAddress;
|
||||
import org.onlab.packet.IpPrefix;
|
||||
import org.onlab.packet.MplsLabel;
|
||||
import org.onlab.packet.TpPort;
|
||||
import org.onosproject.core.ApplicationId;
|
||||
import org.onosproject.incubator.net.resource.label.DefaultLabelResource;
|
||||
import org.onosproject.incubator.net.resource.label.LabelResource;
|
||||
@ -184,7 +183,7 @@ public final class PceccSrTeBeHandler {
|
||||
|
||||
// Check whether node-label was already configured for this specific device.
|
||||
if (pceStore.getGlobalNodeLabel(specificDeviceId) != null) {
|
||||
log.error("Node label was already configured for device {}.", specificDeviceId.toString());
|
||||
log.debug("Node label was already configured for device {}.", specificDeviceId.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -228,12 +227,15 @@ public final class PceccSrTeBeHandler {
|
||||
|
||||
// Push to device
|
||||
// Push label information of specificDeviceId to otherDevId in list and vice versa.
|
||||
advertiseNodeLabelRule(otherDevId, specificLabelId,
|
||||
IpPrefix.valueOf(IpAddress.valueOf(specificLsrId), PREFIX_LENGTH),
|
||||
Objective.Operation.ADD, false);
|
||||
advertiseNodeLabelRule(specificDeviceId, otherLabelId,
|
||||
IpPrefix.valueOf(IpAddress.valueOf(otherLsrId), PREFIX_LENGTH),
|
||||
Objective.Operation.ADD, false);
|
||||
if (!otherDevId.equals(specificDeviceId)) {
|
||||
advertiseNodeLabelRule(otherDevId, specificLabelId,
|
||||
IpPrefix.valueOf(IpAddress.valueOf(specificLsrId), PREFIX_LENGTH),
|
||||
Objective.Operation.ADD, false);
|
||||
|
||||
advertiseNodeLabelRule(specificDeviceId, otherLabelId,
|
||||
IpPrefix.valueOf(IpAddress.valueOf(otherLsrId), PREFIX_LENGTH),
|
||||
Objective.Operation.ADD, false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -519,8 +521,8 @@ public final class PceccSrTeBeHandler {
|
||||
TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
|
||||
|
||||
selectorBuilder.matchMplsLabel(MplsLabel.mplsLabel(labelId.id().intValue()));
|
||||
selectorBuilder.matchTcpSrc(TpPort.tpPort((int) srcPortNum.toLong()));
|
||||
selectorBuilder.matchTcpDst(TpPort.tpPort((int) dstPortNum.toLong()));
|
||||
selectorBuilder.matchIPSrc(IpPrefix.valueOf((int) srcPortNum.toLong(), 32));
|
||||
selectorBuilder.matchIPDst(IpPrefix.valueOf((int) dstPortNum.toLong(), 32));
|
||||
|
||||
TrafficTreatment treatment = DefaultTrafficTreatment.builder().build();
|
||||
|
||||
|
||||
@ -219,19 +219,19 @@ public class DistributedPceStore implements PceStore {
|
||||
@Override
|
||||
public LabelResourceId getGlobalNodeLabel(DeviceId id) {
|
||||
checkNotNull(id, DEVICE_ID_NULL);
|
||||
return globalNodeLabelMap.get(id).value();
|
||||
return globalNodeLabelMap.get(id) == null ? null : globalNodeLabelMap.get(id).value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabelResourceId getAdjLabel(Link link) {
|
||||
checkNotNull(link, LINK_NULL);
|
||||
return adjLabelMap.get(link).value();
|
||||
return adjLabelMap.get(link) == null ? null : adjLabelMap.get(link).value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PceccTunnelInfo getTunnelInfo(TunnelId tunnelId) {
|
||||
checkNotNull(tunnelId, TUNNEL_ID_NULL);
|
||||
return tunnelInfoMap.get(tunnelId).value();
|
||||
return tunnelInfoMap.get(tunnelId) == null ? null : tunnelInfoMap.get(tunnelId).value();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.onosproject.provider.pcep.tunnel.impl;
|
||||
package org.onosproject.pcep.controller;
|
||||
|
||||
/**
|
||||
* Collection of keys for annotation for PCEP tunnels.
|
||||
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.onosproject.provider.pcep.tunnel.impl;
|
||||
package org.onosproject.pcep.controller;
|
||||
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
@ -62,6 +62,8 @@ import org.onosproject.pcepio.types.PcepValueType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.onosproject.pcep.controller.PcepSyncStatus.NOT_SYNCED;
|
||||
|
||||
/**
|
||||
* Channel handler deals with the pcc client connection and dispatches
|
||||
* messages from client to the appropriate locations.
|
||||
@ -233,6 +235,11 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler {
|
||||
h.pcepPacketStats);
|
||||
//Get pc instance and set capabilities
|
||||
h.pc.setCapability(h.capability);
|
||||
|
||||
// Initilialize DB sync status.
|
||||
h.pc.setLspDbSyncStatus(NOT_SYNCED);
|
||||
h.pc.setLabelDbSyncStatus(NOT_SYNCED);
|
||||
|
||||
// set the status of pcc as connected
|
||||
h.pc.setConnected(true);
|
||||
h.pc.setChannel(h.channel);
|
||||
@ -258,6 +265,7 @@ class PcepChannelHandler extends IdleStateAwareChannelHandler {
|
||||
log.debug("Keep alive time : " + keepAliveTimer);
|
||||
|
||||
//set the state handshake completion.
|
||||
|
||||
h.sendKeepAliveMessage();
|
||||
h.pcepPacketStats.addOutPacket();
|
||||
h.setHandshakeComplete(true);
|
||||
|
||||
@ -434,10 +434,16 @@ public class PcepClientControllerImpl implements PcepClientController {
|
||||
}
|
||||
|
||||
List<PcepStateReport> syncStateRptList = pc.getSyncMsgList(pccId);
|
||||
if (syncStateRptList == null) {
|
||||
// When there are no LSPs to sync, directly end-of-sync PCRpt will come and the
|
||||
// list will be null.
|
||||
syncStateRptList = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
Iterator<PcepStateReport> stateRptListIterator = syncStateRptList.iterator();
|
||||
|
||||
// For every report, fetch PLSP id, local LSP id and symbolic path name from the message.
|
||||
while (syncStateRptList.iterator().hasNext()) {
|
||||
while (stateRptListIterator.hasNext()) {
|
||||
PcepStateReport stateRpt = stateRptListIterator.next();
|
||||
Tunnel tunnel = null;
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ public class PcepClientImpl implements PcepClientDriver {
|
||||
private byte sessionId;
|
||||
private PcepPacketStatsImpl pktStats;
|
||||
private Map<LspKey, Boolean> lspDelegationInfo;
|
||||
private Map<PccId, List<PcepStateReport>> sycRptCache = new HashMap<>();
|
||||
private Map<PccId, List<PcepStateReport>> syncRptCache = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init(PccId pccId, PcepVersion pcepVersion, PcepPacketStats pktStats) {
|
||||
@ -267,24 +267,24 @@ public class PcepClientImpl implements PcepClientDriver {
|
||||
@Override
|
||||
public void initializeSyncMsgList(PccId pccId) {
|
||||
List<PcepStateReport> rptMsgList = new LinkedList<>();
|
||||
sycRptCache.put(pccId, rptMsgList);
|
||||
syncRptCache.put(pccId, rptMsgList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PcepStateReport> getSyncMsgList(PccId pccId) {
|
||||
return sycRptCache.get(pccId);
|
||||
return syncRptCache.get(pccId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeSyncMsgList(PccId pccId) {
|
||||
sycRptCache.remove(pccId);
|
||||
syncRptCache.remove(pccId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSyncMsgToList(PccId pccId, PcepStateReport rptMsg) {
|
||||
List<PcepStateReport> rptMsgList = sycRptCache.get(pccId);
|
||||
List<PcepStateReport> rptMsgList = syncRptCache.get(pccId);
|
||||
rptMsgList.add(rptMsg);
|
||||
sycRptCache.put(pccId, rptMsgList);
|
||||
syncRptCache.put(pccId, rptMsgList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -15,6 +15,9 @@
|
||||
*/
|
||||
package org.onosproject.provider.bgpcep.flow.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@ -28,7 +31,6 @@ import org.onlab.packet.IpAddress;
|
||||
import org.onlab.packet.IpPrefix;
|
||||
import org.onlab.packet.MplsLabel;
|
||||
import org.onosproject.bgp.controller.BgpController;
|
||||
import org.onosproject.cfg.ComponentConfigService;
|
||||
import org.onosproject.core.ApplicationId;
|
||||
import org.onosproject.incubator.net.resource.label.LabelResourceId;
|
||||
import org.onosproject.incubator.net.tunnel.IpTunnelEndPoint;
|
||||
@ -42,21 +44,24 @@ import org.onosproject.net.Link;
|
||||
import org.onosproject.net.Path;
|
||||
import org.onosproject.net.PortNumber;
|
||||
import org.onosproject.net.device.DeviceService;
|
||||
import org.onosproject.net.flow.CompletedBatchOperation;
|
||||
import org.onosproject.net.flow.DefaultFlowEntry;
|
||||
import org.onosproject.net.flow.FlowEntry;
|
||||
import org.onosproject.net.flow.FlowRule;
|
||||
import org.onosproject.net.flow.FlowRuleBatchEntry;
|
||||
import org.onosproject.net.flow.FlowRuleBatchOperation;
|
||||
import org.onosproject.net.flow.FlowRuleProvider;
|
||||
import org.onosproject.net.flow.FlowRuleProviderRegistry;
|
||||
import org.onosproject.net.flow.FlowRuleProviderService;
|
||||
import org.onosproject.net.flow.TrafficSelector;
|
||||
import org.onosproject.net.flow.FlowEntry.FlowEntryState;
|
||||
import org.onosproject.net.flow.criteria.Criterion;
|
||||
import org.onosproject.net.flow.criteria.IPCriterion;
|
||||
import org.onosproject.net.flow.criteria.MetadataCriterion;
|
||||
import org.onosproject.net.flow.criteria.MplsBosCriterion;
|
||||
import org.onosproject.net.flow.criteria.MplsCriterion;
|
||||
import org.onosproject.net.flow.criteria.PortCriterion;
|
||||
import org.onosproject.net.flow.criteria.TcpPortCriterion;
|
||||
import org.onosproject.net.flow.criteria.TunnelIdCriterion;
|
||||
import org.onosproject.net.flowobjective.Objective;
|
||||
import org.onosproject.net.provider.AbstractProvider;
|
||||
import org.onosproject.net.provider.ProviderId;
|
||||
import org.onosproject.net.resource.ResourceService;
|
||||
@ -81,13 +86,14 @@ import org.onosproject.pcepio.types.PcepLabelDownload;
|
||||
import org.onosproject.pcepio.types.PcepLabelMap;
|
||||
import org.onosproject.pcepio.types.PcepValueType;
|
||||
import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv;
|
||||
import org.onosproject.provider.pcep.tunnel.impl.SrpIdGenerators;
|
||||
import org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys;
|
||||
import org.onosproject.pcep.controller.SrpIdGenerators;
|
||||
import org.onosproject.pcep.controller.PcepAnnotationKeys;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import static org.onosproject.pcep.controller.PcepSyncStatus.IN_SYNC;
|
||||
import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED;
|
||||
import static org.onosproject.net.flow.criteria.Criterion.Type.EXTENSION;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
||||
@ -103,9 +109,6 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
|
||||
protected FlowRuleProviderRegistry providerRegistry;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
|
||||
protected ComponentConfigService cfgService;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
|
||||
protected BgpController bgpController;
|
||||
|
||||
@ -129,6 +132,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
public static final long SET = 0xFFFFFFFFL;
|
||||
private static final String LSRID = "lsrId";
|
||||
|
||||
private enum PcepFlowType {
|
||||
ADD,
|
||||
MODIFY,
|
||||
REMOVE
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a BgpFlow host provider.
|
||||
*/
|
||||
@ -138,14 +147,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext context) {
|
||||
cfgService.registerProperties(getClass());
|
||||
providerService = providerRegistry.register(this);
|
||||
log.info("Started");
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate(ComponentContext context) {
|
||||
cfgService.unregisterProperties(getClass(), false);
|
||||
providerRegistry.unregister(this);
|
||||
providerService = null;
|
||||
log.info("Stopped");
|
||||
@ -154,26 +161,25 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
@Override
|
||||
public void applyFlowRule(FlowRule... flowRules) {
|
||||
for (FlowRule flowRule : flowRules) {
|
||||
processRule(flowRule, Objective.Operation.ADD);
|
||||
processRule(flowRule, PcepFlowType.ADD);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFlowRule(FlowRule... flowRules) {
|
||||
for (FlowRule flowRule : flowRules) {
|
||||
processRule(flowRule, Objective.Operation.REMOVE);
|
||||
processRule(flowRule, PcepFlowType.REMOVE);
|
||||
}
|
||||
}
|
||||
|
||||
private void processRule(FlowRule flowRule, Objective.Operation type) {
|
||||
private void processRule(FlowRule flowRule, PcepFlowType type) {
|
||||
MplsLabel mplsLabel = null;
|
||||
IpPrefix ip4Prefix = null;
|
||||
IpPrefix ip4PrefixSrc = null;
|
||||
IpPrefix ip4PrefixDst = null;
|
||||
PortNumber port = null;
|
||||
TunnelId tunnelId = null;
|
||||
long labelType = 0;
|
||||
boolean bottomOfStack = false;
|
||||
int srcPort = 0;
|
||||
int dstPort = 0;
|
||||
|
||||
TrafficSelector selector = flowRule.selector();
|
||||
for (Criterion c : selector.criteria()) {
|
||||
@ -184,20 +190,16 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
break;
|
||||
case IPV4_SRC:
|
||||
IPCriterion ipCriterion = (IPCriterion) c;
|
||||
ip4Prefix = ipCriterion.ip().getIp4Prefix();
|
||||
ip4PrefixSrc = ipCriterion.ip().getIp4Prefix();
|
||||
break;
|
||||
case IPV4_DST:
|
||||
ipCriterion = (IPCriterion) c;
|
||||
ip4PrefixDst = ipCriterion.ip().getIp4Prefix();
|
||||
break;
|
||||
case IN_PORT:
|
||||
PortCriterion inPort = (PortCriterion) c;
|
||||
port = inPort.port();
|
||||
break;
|
||||
case TCP_SRC:
|
||||
TcpPortCriterion srcTcpPort = (TcpPortCriterion) c;
|
||||
srcPort = srcTcpPort.tcpPort().toInt();
|
||||
break;
|
||||
case TCP_DST:
|
||||
TcpPortCriterion dstTcpPort = (TcpPortCriterion) c;
|
||||
dstPort = dstTcpPort.tcpPort().toInt();
|
||||
break;
|
||||
case TUNNEL_ID:
|
||||
TunnelIdCriterion tc = (TunnelIdCriterion) c;
|
||||
tunnelId = TunnelId.valueOf(String.valueOf(tc.tunnelId()));
|
||||
@ -224,13 +226,12 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
return;
|
||||
}
|
||||
|
||||
if (srcPort != 0 && dstPort != 0) {
|
||||
pushAdjacencyLabel(flowRule.deviceId(), label, PortNumber.portNumber(srcPort),
|
||||
PortNumber.portNumber(dstPort), type);
|
||||
if (ip4PrefixDst != null) {
|
||||
pushAdjacencyLabel(flowRule.deviceId(), label, ip4PrefixSrc, ip4PrefixDst, type);
|
||||
return;
|
||||
}
|
||||
|
||||
pushGlobalNodeLabel(flowRule.deviceId(), label, ip4Prefix, type, bottomOfStack);
|
||||
pushGlobalNodeLabel(flowRule.deviceId(), label, ip4PrefixSrc, type, bottomOfStack);
|
||||
|
||||
} catch (PcepParseException e) {
|
||||
log.error("Exception occured while sending label message to PCC {}", e.getMessage());
|
||||
@ -255,7 +256,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
|
||||
//Pushes node labels to the specified device.
|
||||
private void pushGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId,
|
||||
IpPrefix ipPrefix, Objective.Operation type, boolean isBos) throws PcepParseException {
|
||||
IpPrefix ipPrefix, PcepFlowType type, boolean isBos) throws PcepParseException {
|
||||
|
||||
checkNotNull(deviceId);
|
||||
checkNotNull(labelId);
|
||||
@ -271,7 +272,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
|
||||
if (ipPrefix == null) {
|
||||
// Pushing self node label to device.
|
||||
IpPrefix.valueOf(pc.getPccId().ipAddress(), 32);
|
||||
ipPrefix = IpPrefix.valueOf(pc.getPccId().ipAddress(), 32);
|
||||
}
|
||||
|
||||
PcepFecObjectIPv4 fecObject = pc.factory().buildFecObjectIpv4()
|
||||
@ -279,16 +280,9 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
.build();
|
||||
|
||||
boolean bSFlag = false;
|
||||
if (pc.labelDbSyncStatus() == IN_SYNC) {
|
||||
if (isBos) {
|
||||
/*
|
||||
* Now the sync is completed.
|
||||
* Need to send label DB end-of-sync msg, i.e. S flag in SRP id is reset.
|
||||
*/
|
||||
pc.setLabelDbSyncStatus(SYNCED);
|
||||
} else {
|
||||
bSFlag = true;
|
||||
}
|
||||
if (pc.labelDbSyncStatus() == IN_SYNC && !isBos) {
|
||||
// Need to set sync flag in all messages till sync completes.
|
||||
bSFlag = true;
|
||||
}
|
||||
|
||||
PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag);
|
||||
@ -312,14 +306,19 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
.build();
|
||||
|
||||
pc.sendMessage(labelMsg);
|
||||
|
||||
if (isBos) {
|
||||
// Sync is completed.
|
||||
pc.setLabelDbSyncStatus(SYNCED);
|
||||
}
|
||||
}
|
||||
|
||||
private PcepSrpObject getSrpObject(PcepClient pc, Objective.Operation type, boolean bSFlag)
|
||||
private PcepSrpObject getSrpObject(PcepClient pc, PcepFlowType type, boolean bSFlag)
|
||||
throws PcepParseException {
|
||||
PcepSrpObject srpObj;
|
||||
boolean bRFlag = false;
|
||||
|
||||
if (!type.equals(Objective.Operation.ADD)) {
|
||||
if (!type.equals(PcepFlowType.ADD)) {
|
||||
// To cleanup labels, R bit is set
|
||||
bRFlag = true;
|
||||
}
|
||||
@ -334,13 +333,14 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
}
|
||||
|
||||
//Pushes adjacency labels to the specified device.
|
||||
private void pushAdjacencyLabel(DeviceId deviceId, LabelResourceId labelId,
|
||||
PortNumber srcPortNum, PortNumber dstPortNum, Objective.Operation type) throws PcepParseException {
|
||||
private void pushAdjacencyLabel(DeviceId deviceId, LabelResourceId labelId, IpPrefix ip4PrefixSrc,
|
||||
IpPrefix ip4PrefixDst, PcepFlowType type)
|
||||
throws PcepParseException {
|
||||
|
||||
checkNotNull(deviceId);
|
||||
checkNotNull(labelId);
|
||||
checkNotNull(srcPortNum);
|
||||
checkNotNull(dstPortNum);
|
||||
checkNotNull(ip4PrefixSrc);
|
||||
checkNotNull(ip4PrefixDst);
|
||||
checkNotNull(type);
|
||||
|
||||
PcepClient pc = getPcepClient(deviceId);
|
||||
@ -351,17 +351,21 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
|
||||
LinkedList<PcepLabelUpdate> labelUpdateList = new LinkedList<>();
|
||||
|
||||
long srcPortNo = srcPortNum.toLong();
|
||||
long dstPortNo = dstPortNum.toLong();
|
||||
srcPortNo = ((srcPortNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? srcPortNo & SET : srcPortNo;
|
||||
dstPortNo = ((dstPortNo & IDENTIFIER_SET) == IDENTIFIER_SET) ? dstPortNo & SET : dstPortNo;
|
||||
int srcPortNo = ip4PrefixSrc.address().getIp4Address().toInt();
|
||||
int dstPortNo = ip4PrefixDst.address().getIp4Address().toInt();
|
||||
|
||||
PcepFecObjectIPv4Adjacency fecAdjObject = pc.factory().buildFecIpv4Adjacency()
|
||||
.seRemoteIPv4Address((int) dstPortNo)
|
||||
.seLocalIPv4Address((int) srcPortNo)
|
||||
.seRemoteIPv4Address(dstPortNo)
|
||||
.seLocalIPv4Address(srcPortNo)
|
||||
.build();
|
||||
|
||||
PcepSrpObject srpObj = getSrpObject(pc, type, false);
|
||||
boolean bSFlag = false;
|
||||
if (pc.labelDbSyncStatus() == IN_SYNC) {
|
||||
// Need to set sync flag in all messages till sync completes.
|
||||
bSFlag = true;
|
||||
}
|
||||
|
||||
PcepSrpObject srpObj = getSrpObject(pc, type, bSFlag);
|
||||
|
||||
//Adjacency label object
|
||||
PcepLabelObject labelObject = pc.factory().buildLabelObject()
|
||||
@ -387,7 +391,7 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
//Pushes local labels to the device which is specific to path [CR-case].
|
||||
private void pushLocalLabels(DeviceId deviceId, LabelResourceId labelId,
|
||||
PortNumber portNum, TunnelId tunnelId,
|
||||
Boolean isBos, Long labelType, Objective.Operation type) throws PcepParseException {
|
||||
Boolean isBos, Long labelType, PcepFlowType type) throws PcepParseException {
|
||||
|
||||
checkNotNull(deviceId);
|
||||
checkNotNull(labelId);
|
||||
@ -559,6 +563,31 @@ public class BgpcepFlowRuleProvider extends AbstractProvider
|
||||
|
||||
@Override
|
||||
public void executeBatch(FlowRuleBatchOperation batch) {
|
||||
//TODO
|
||||
Collection<FlowEntry> flowEntries = new ArrayList<>();
|
||||
|
||||
for (FlowRuleBatchEntry fbe : batch.getOperations()) {
|
||||
Criterion criteria = fbe.target().selector().getCriterion(EXTENSION);
|
||||
|
||||
switch (fbe.operator()) {
|
||||
case ADD:
|
||||
if (criteria == null) {
|
||||
processRule(fbe.target(), PcepFlowType.ADD);
|
||||
flowEntries.add(new DefaultFlowEntry(fbe.target(), FlowEntryState.ADDED, 0, 0, 0));
|
||||
}
|
||||
break;
|
||||
case REMOVE:
|
||||
if (criteria == null) {
|
||||
processRule(fbe.target(), PcepFlowType.REMOVE);
|
||||
flowEntries.add(new DefaultFlowEntry(fbe.target(), FlowEntryState.REMOVED, 0, 0, 0));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log.error("Unknown flow operation: {}", fbe);
|
||||
}
|
||||
}
|
||||
|
||||
CompletedBatchOperation status = new CompletedBatchOperation(true, Collections.emptySet(), batch.deviceId());
|
||||
providerService.batchOperationCompleted(batch.id(), status);
|
||||
providerService.pushFlowMetrics(batch.deviceId(), flowEntries);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,6 +82,7 @@ import org.onosproject.pcep.controller.PcepClientListener;
|
||||
import org.onosproject.pcep.controller.PcepEventListener;
|
||||
import org.onosproject.pcep.controller.PcepLspStatus;
|
||||
import org.onosproject.pcep.controller.PcepLspSyncAction;
|
||||
import org.onosproject.pcep.controller.SrpIdGenerators;
|
||||
import org.onosproject.pcepio.exceptions.PcepParseException;
|
||||
import org.onosproject.pcepio.protocol.PcInitiatedLspRequest;
|
||||
import org.onosproject.pcepio.protocol.PcepAttribute;
|
||||
@ -131,13 +132,13 @@ import static org.onosproject.net.PortNumber.portNumber;
|
||||
import static org.onosproject.pcep.api.PcepDpid.uri;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.BANDWIDTH;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LOCAL_LSP_ID;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.PCC_TUNNEL_ID;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.PLSP_ID;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.DELEGATE;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.COST_TYPE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCC_TUNNEL_ID;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.COST_TYPE;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.RequestType.CREATE;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.RequestType.DELETE;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.RequestType.LSP_STATE_RPT;
|
||||
|
||||
@ -23,7 +23,7 @@ import static org.onosproject.net.DefaultAnnotations.EMPTY;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -23,7 +23,7 @@ import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.SR_WITHOUT_SIGNALLING;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -19,12 +19,12 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
import static org.onosproject.incubator.net.tunnel.Tunnel.Type.MPLS;
|
||||
import static org.onosproject.incubator.net.tunnel.Tunnel.State.INIT;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.BANDWIDTH;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LOCAL_LSP_ID;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.PCC_TUNNEL_ID;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.PLSP_ID;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.DELEGATE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.BANDWIDTH;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.PCC_TUNNEL_ID;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.DELEGATE;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITHOUT_SIGNALLING_AND_WITHOUT_SR;
|
||||
import static org.onosproject.pcep.controller.PcepSyncStatus.SYNCED;
|
||||
import static org.onosproject.net.Device.Type.ROUTER;
|
||||
|
||||
@ -20,7 +20,7 @@ import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.hamcrest.core.IsNot.not;
|
||||
import static org.onosproject.net.DefaultAnnotations.EMPTY;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -20,7 +20,9 @@ import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
import static org.hamcrest.core.IsNot.not;
|
||||
import static org.onosproject.net.DefaultAnnotations.EMPTY;
|
||||
import static org.onosproject.provider.pcep.tunnel.impl.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LSP_SIG_TYPE;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.LOCAL_LSP_ID;
|
||||
import static org.onosproject.pcep.controller.PcepAnnotationKeys.PLSP_ID;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -112,8 +114,8 @@ public class PcepUpdateTunnelProviderTest {
|
||||
path = new DefaultPath(pid, links, 20, EMPTY);
|
||||
|
||||
Annotations annotations = DefaultAnnotations.builder()
|
||||
.set(PcepAnnotationKeys.PLSP_ID, "1")
|
||||
.set(PcepAnnotationKeys.LOCAL_LSP_ID, "1")
|
||||
.set(PLSP_ID, "1")
|
||||
.set(LOCAL_LSP_ID, "1")
|
||||
.set(LSP_SIG_TYPE, WITH_SIGNALLING.name())
|
||||
.build();
|
||||
|
||||
@ -173,8 +175,8 @@ public class PcepUpdateTunnelProviderTest {
|
||||
|
||||
Annotations annotations = DefaultAnnotations.builder()
|
||||
.set(LSP_SIG_TYPE, WITH_SIGNALLING.name())
|
||||
.set(PcepAnnotationKeys.PLSP_ID, "1")
|
||||
.set(PcepAnnotationKeys.LOCAL_LSP_ID, "1")
|
||||
.set(PLSP_ID, "1")
|
||||
.set(LOCAL_LSP_ID, "1")
|
||||
.build();
|
||||
|
||||
tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS,
|
||||
@ -233,8 +235,8 @@ public class PcepUpdateTunnelProviderTest {
|
||||
|
||||
Annotations annotations = DefaultAnnotations.builder()
|
||||
.set(LSP_SIG_TYPE, SR_WITHOUT_SIGNALLING.name())
|
||||
.set(PcepAnnotationKeys.PLSP_ID, "1")
|
||||
.set(PcepAnnotationKeys.LOCAL_LSP_ID, "1")
|
||||
.set(PLSP_ID, "1")
|
||||
.set(LOCAL_LSP_ID, "1")
|
||||
.build();
|
||||
|
||||
tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS,
|
||||
@ -293,8 +295,8 @@ public class PcepUpdateTunnelProviderTest {
|
||||
|
||||
Annotations annotations = DefaultAnnotations.builder()
|
||||
.set(LSP_SIG_TYPE, WITHOUT_SIGNALLING_AND_WITHOUT_SR.name())
|
||||
.set(PcepAnnotationKeys.PLSP_ID, "1")
|
||||
.set(PcepAnnotationKeys.LOCAL_LSP_ID, "1")
|
||||
.set(PLSP_ID, "1")
|
||||
.set(LOCAL_LSP_ID, "1")
|
||||
.build();
|
||||
|
||||
tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user