[ONOS-4167] Identify the impacted tunnels based on network events, notify to PCE app and trigger MBB flow.
Change-Id: I1766f4afbc0ee2f4c05c75cf788c91f9df8aaa9a
diff --git a/providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepUpdateTunnelProviderTest.java b/providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepUpdateTunnelProviderTest.java
index 2c9961f..4106dfb 100644
--- a/providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepUpdateTunnelProviderTest.java
+++ b/providers/pcep/tunnel/src/test/java/org/onosproject/provider/pcep/tunnel/impl/PcepUpdateTunnelProviderTest.java
@@ -47,6 +47,10 @@
import org.onosproject.net.Path;
import org.onosproject.net.PortNumber;
import org.onosproject.net.provider.ProviderId;
+import org.onosproject.pcep.controller.ClientCapability;
+import org.onosproject.pcep.controller.LspKey;
+import org.onosproject.pcep.controller.PccId;
+import org.onosproject.pcepio.protocol.PcepVersion;
import org.onosproject.pcepio.types.StatefulIPv4LspIdentifiersTlv;
import static org.onosproject.provider.pcep.tunnel.impl.LspType.WITH_SIGNALLING;
@@ -99,7 +103,7 @@
ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023));
- ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023));
+ ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10024));
Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst)
.type(Link.Type.DIRECT).build();
@@ -108,6 +112,8 @@
path = new DefaultPath(pid, links, 20, EMPTY);
Annotations annotations = DefaultAnnotations.builder()
+ .set(PcepAnnotationKeys.PLSP_ID, "1")
+ .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1")
.set(LSP_SIG_TYPE, WITH_SIGNALLING.name())
.build();
@@ -124,6 +130,12 @@
tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData);
+ PccId pccId = PccId.pccId(IpAddress.valueOf(0xD010101));
+ PcepClientAdapter pc = new PcepClientAdapter();
+ pc.init(pccId, PcepVersion.PCEP_1);
+ controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true);
+ controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true));
+
tunnelProvider.updateTunnel(tunnel, path);
assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue()));
}
@@ -137,7 +149,7 @@
Path path;
ProviderId pid = new ProviderId("pcep", PROVIDER_ID);
List<Link> links = new ArrayList<>();
- IpAddress srcIp = IpAddress.valueOf(0xC010103);
+ IpAddress srcIp = IpAddress.valueOf(0xD010101);
IpElementId srcElementId = IpElementId.ipElement(srcIp);
IpAddress dstIp = IpAddress.valueOf(0xD010102);
@@ -151,7 +163,7 @@
ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023));
- ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023));
+ ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10024));
Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst)
.type(Link.Type.DIRECT).build();
@@ -161,6 +173,8 @@
Annotations annotations = DefaultAnnotations.builder()
.set(LSP_SIG_TYPE, WITH_SIGNALLING.name())
+ .set(PcepAnnotationKeys.PLSP_ID, "1")
+ .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1")
.build();
tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS,
@@ -176,6 +190,12 @@
tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData);
+ PccId pccId = PccId.pccId(IpAddress.valueOf(0xD010101));
+ PcepClientAdapter pc = new PcepClientAdapter();
+ pc.init(pccId, PcepVersion.PCEP_1);
+ controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true);
+ controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true));
+
tunnelProvider.updateTunnel(tunnel, path);
assertThat(tunnelProvider.pcepTunnelApiMapper.checkFromTunnelRequestQueue(1), is(false));
}
@@ -203,7 +223,7 @@
ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023));
- ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023));
+ ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10024));
Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst)
.type(Link.Type.DIRECT).build();
@@ -213,6 +233,8 @@
Annotations annotations = DefaultAnnotations.builder()
.set(LSP_SIG_TYPE, SR_WITHOUT_SIGNALLING.name())
+ .set(PcepAnnotationKeys.PLSP_ID, "1")
+ .set(PcepAnnotationKeys.LOCAL_LSP_ID, "1")
.build();
tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS,
@@ -228,6 +250,12 @@
tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData);
+ PccId pccId = PccId.pccId(IpAddress.valueOf(0xD010101));
+ PcepClientAdapter pc = new PcepClientAdapter();
+ pc.init(pccId, PcepVersion.PCEP_1);
+ controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true);
+ controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true));
+
tunnelProvider.updateTunnel(tunnel, path);
assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue()));
}
@@ -255,7 +283,7 @@
ConnectPoint src = new ConnectPoint(srcElementId, PortNumber.portNumber(10023));
- ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10023));
+ ConnectPoint dst = new ConnectPoint(dstElementId, PortNumber.portNumber(10024));
Link link = DefaultLink.builder().providerId(pid).src(src).dst(dst)
.type(Link.Type.DIRECT).build();
@@ -265,6 +293,8 @@
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")
.build();
tunnel = new DefaultTunnel(pid, ipTunnelEndPointSrc, ipTunnelEndPointDst, Tunnel.Type.MPLS,
@@ -280,6 +310,12 @@
tunnelProvider.pcepTunnelApiMapper.handleCreateTunnelRequestQueue(1, pcepTunnelData);
+ PccId pccId = PccId.pccId(IpAddress.valueOf(0xD010101));
+ PcepClientAdapter pc = new PcepClientAdapter();
+ pc.init(pccId, PcepVersion.PCEP_1);
+ controller.getClient(pccId).setLspAndDelegationInfo(new LspKey(1, (short) 1), true);
+ controller.getClient(pccId).setCapability(new ClientCapability(true, true, true, true, true));
+
tunnelProvider.updateTunnel(tunnel, path);
assertThat(tunnelProvider.pcepTunnelApiMapper, not(nullValue()));
}