use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcepUpdateTunnelInput1Builder in project bgpcep by opendaylight.
the class TunnelProgrammingTest method testTunnelProgramming.
@Test
public void testTunnelProgramming() throws InterruptedException, ExecutionException {
final Bandwidth bwd = new Bandwidth(new byte[] { 0x00, 0x00, 0x00, (byte) 0xff });
final ClassType classType = new ClassType(Uint8.ONE);
final String tunnelName = "create-tunnel";
final NetworkTopologyRef topologyRef = new NetworkTopologyRef(TOPO_IID);
// create tunnel
tunnelProgramming.pcepCreateP2pTunnel(new PcepCreateP2pTunnelInputBuilder().setDestination(new DestinationBuilder().setNode(NODE2_ID).setTp(TP2_ID).build()).setSource(new SourceBuilder().setNode(NODE1_ID).setTp(TP1_ID).build()).setNetworkTopologyRef(topologyRef).setBandwidth(bwd).setClassType(classType).setSymbolicPathName(tunnelName).addAugmentation(new PcepCreateP2pTunnelInput1Builder().setAdministrativeStatus(AdministrativeStatus.Active).build()).build());
// check add-lsp input
assertNotNull(addLspInput);
assertEquals(tunnelName, addLspInput.getName());
final Arguments agrs = addLspInput.getArguments();
assertNotNull(agrs);
assertEquals(bwd, agrs.getBandwidth().getBandwidth());
assertEquals(classType, agrs.getClassType().getClassType());
final Ipv4 ipv4Endpoints = ((Ipv4Case) agrs.getEndpointsObj().getAddressFamily()).getIpv4();
assertEquals(NODE1_IPV4, ipv4Endpoints.getSourceIpv4Address().getValue());
assertEquals(NODE2_IPV4, ipv4Endpoints.getDestinationIpv4Address().getValue());
assertEquals(NODE1_ID.getValue(), addLspInput.getNode().getValue());
createLink();
// update tunnel
tunnelProgramming.pcepUpdateTunnel(new PcepUpdateTunnelInputBuilder().setNetworkTopologyRef(topologyRef).setBandwidth(bwd).setClassType(classType).setExplicitHops(BindingMap.ordered(createExplicitHop(IPV4_PREFIX1, Uint32.ONE), createExplicitHop(IPV4_PREFIX2, Uint32.TWO))).setLinkId(LINK1_ID).addAugmentation(new PcepUpdateTunnelInput1Builder().setAdministrativeStatus(AdministrativeStatus.Active).build()).build());
// check update-lsp input
assertNotNull(updateLspInput);
assertEquals(LINK1_ID.getValue(), updateLspInput.getName());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.update.lsp.args.Arguments updArgs = updateLspInput.getArguments();
assertEquals(2, updArgs.getEro().nonnullSubobject().size());
final List<Subobject> subObjects = updArgs.getEro().nonnullSubobject();
final IpPrefixCase prefix1 = (IpPrefixCase) subObjects.get(0).getSubobjectType();
final IpPrefixCase prefix2 = (IpPrefixCase) subObjects.get(1).getSubobjectType();
assertEquals(IPV4_PREFIX1, prefix1.getIpPrefix().getIpPrefix().getIpv4Prefix().getValue());
assertEquals(IPV4_PREFIX2, prefix2.getIpPrefix().getIpPrefix().getIpv4Prefix().getValue());
// delete tunnel
final PcepDestroyTunnelInputBuilder destroyInputBuilder = new PcepDestroyTunnelInputBuilder();
destroyInputBuilder.setLinkId(LINK1_ID);
destroyInputBuilder.setNetworkTopologyRef(topologyRef);
tunnelProgramming.pcepDestroyTunnel(destroyInputBuilder.build());
assertNotNull(removeLspInput);
assertEquals(LINK1_ID.getValue(), removeLspInput.getName());
assertEquals(NODE1_ID, removeLspInput.getNode());
}
Aggregations