use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments in project netvirt by opendaylight.
the class ShowVpnIpToPort method doExecute.
@Override
@SuppressWarnings("checkstyle:RegexpSinglelineJava")
protected Object doExecute() throws Exception {
if (vpnName == null && portFixedIp == null) {
getNeutronVpnPort();
getLearntVpnVipPort();
System.out.println(vpnPortipToPortList.size() + " Entries are present: ");
System.out.println("-----------------------------------------------------------------------");
System.out.println(String.format(" %s %24s %20s %32s", "VpnName", "IPAddress", "MacAddress", "Port"));
System.out.println("-----------------------------------------------------------------------");
for (VpnPortipToPort vpnPortipToPort : vpnPortipToPortList) {
System.out.println(String.format(" %-32s %-16s %-16s %-32s", vpnPortipToPort.getVpnName(), vpnPortipToPort.getPortFixedip(), vpnPortipToPort.getMacAddress(), vpnPortipToPort.getPortName()));
}
for (LearntVpnVipToPort learntVpnVipToPort : vpnVipToPortList) {
System.out.println(String.format("* %-32s %-16s %-16s %-32s", learntVpnVipToPort.getVpnName(), learntVpnVipToPort.getPortFixedip(), learntVpnVipToPort.getMacAddress(), learntVpnVipToPort.getPortName()));
}
System.out.println("\n * prefixed entries are Learned.");
System.out.println("\n" + getshowVpnCLIHelp());
} else if (portFixedIp == null || vpnName == null) {
System.out.println("Insufficient arguments" + "\nCorrect Usage : neutronvpn-port-show [<vpnName> <portFixedIp>]");
} else {
InstanceIdentifier<VpnPortipToPort> id = InstanceIdentifier.builder(NeutronVpnPortipPortData.class).child(VpnPortipToPort.class, new VpnPortipToPortKey(portFixedIp, vpnName)).build();
Optional<VpnPortipToPort> vpnPortipToPortData = syncReadOptional(dataBroker, CONFIGURATION, id);
if (vpnPortipToPortData.isPresent()) {
VpnPortipToPort data = vpnPortipToPortData.get();
System.out.println("\n----------" + "---------------------------------------------------------------------------------");
System.out.println("VpnName: " + data.getVpnName() + "\nIPAddress: " + data.getPortFixedip() + "\nMacAddress: " + data.getMacAddress() + "\nPort: " + data.getPortName());
System.out.println("\n----------" + "---------------------------------------------------------------------------------");
} else {
InstanceIdentifier<LearntVpnVipToPort> learntId = InstanceIdentifier.builder(LearntVpnVipToPortData.class).child(LearntVpnVipToPort.class, new LearntVpnVipToPortKey(portFixedIp, vpnName)).build();
Optional<LearntVpnVipToPort> learntVpnVipToPortData = syncReadOptional(dataBroker, OPERATIONAL, learntId);
if (!learntVpnVipToPortData.isPresent()) {
System.out.println("Data not available");
return null;
}
LearntVpnVipToPort data = learntVpnVipToPortData.get();
System.out.println("\n----------" + "---------------------------------------------------------------------------------");
System.out.println("VpnName: * " + data.getVpnName() + "\nIPAddress: " + data.getPortFixedip() + "\nMacAddress: " + data.getMacAddress() + "\nPort: " + data.getPortName());
System.out.println("\n----------" + "---------------------------------------------------------------------------------");
}
System.out.println("\n" + getshowVpnCLIHelp());
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments in project bgpcep by opendaylight.
the class PCEPTopologySessionListener method ensureLspOperational.
@Override
public synchronized ListenableFuture<OperationResult> ensureLspOperational(final EnsureLspOperationalInput input) {
checkArgument(input != null && input.getName() != null && input.getNode() != null, MISSING_XML_TAG);
final Arguments args = input.getArguments();
checkArgument(args != null, MISSING_XML_TAG);
final OperationalStatus op;
final Arguments1 aa = args.augmentation(Arguments1.class);
if (aa != null) {
op = aa.getOperational();
} else {
op = null;
}
// Make sure the LSP exists
final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName());
LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
final ListenableFuture<Optional<ReportedLsp>> f = readOperationalData(lsp);
return f == null ? OperationResults.createUnsent(PCEPErrors.LSP_INTERNAL_ERROR).future() : listenableFuture(f, input, op);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments in project bgpcep by opendaylight.
the class BGPTestTool method start.
void start(final Arguments arguments) {
final BGPDispatcher dispatcher = initializeActivator();
final ArrayList<OptionalCapabilities> optCap = Lists.newArrayList(createMPCapability(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class), createMPCapability(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class), createMPCapability(Ipv4AddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class), createMPCapability(Ipv6AddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class), createMPCapability(Ipv4AddressFamily.class, McastMplsLabeledVpnSubsequentAddressFamily.class), createMPCapability(Ipv6AddressFamily.class, McastMplsLabeledVpnSubsequentAddressFamily.class), createMPCapability(L2vpnAddressFamily.class, EvpnSubsequentAddressFamily.class), createMPCapability(Ipv4AddressFamily.class, RouteTargetConstrainSubsequentAddressFamily.class), createAs4BytesMPCapability(arguments.getAs()));
if (arguments.getMultiPathSupport()) {
optCap.add(createAddPathCapability());
}
final BgpParameters bgpParameters = createBgpParameters(optCap);
final InetSocketAddress localAddress = arguments.getLocalAddresses();
final int port = localAddress.getPort();
InetAddress address = localAddress.getAddress();
int numberOfSpeakers = arguments.getSpeakerCount();
do {
final BGPSessionListener sessionListener = new TestingListener(arguments.getNumberOfPrefixes(), arguments.getExtendedCommunities(), arguments.getMultiPathSupport());
this.listeners.put(address.getHostAddress(), sessionListener);
createPeer(dispatcher, arguments, new InetSocketAddress(address, port), sessionListener, bgpParameters);
numberOfSpeakers--;
address = InetAddresses.increment(address);
} while (numberOfSpeakers > 0);
}
Aggregations