use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.Arguments in project bgpcep by opendaylight.
the class CreateTunnelInstructionExecutor method buildArguments.
private Arguments buildArguments(final TerminationPoint sp, final TerminationPoint dp) {
final ArgumentsBuilder args = new ArgumentsBuilder();
if (this.p2pTunnelInput.getBandwidth() != null) {
args.setBandwidth(new BandwidthBuilder().setBandwidth(this.p2pTunnelInput.getBandwidth()).build());
}
if (this.p2pTunnelInput.getClassType() != null) {
args.setClassType(new ClassTypeBuilder().setClassType(this.p2pTunnelInput.getClassType()).build());
}
args.setEndpointsObj(new EndpointsObjBuilder().setAddressFamily(buildAddressFamily(sp, dp)).build());
args.setEro(TunelProgrammingUtil.buildEro(this.p2pTunnelInput.getExplicitHops()));
args.setLspa(new LspaBuilder(this.p2pTunnelInput).build());
final AdministrativeStatus adminStatus = this.p2pTunnelInput.getAugmentation(PcepCreateP2pTunnelInput1.class).getAdministrativeStatus();
if (adminStatus != null) {
args.addAugmentation(Arguments2.class, new Arguments2Builder().setLsp(new LspBuilder().setAdministrative(adminStatus == AdministrativeStatus.Active).build()).build());
}
return args.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.Arguments in project bgpcep by opendaylight.
the class BGPPeerBuilder method createPeer.
static void createPeer(final BGPDispatcher dispatcher, final Arguments arguments, final InetSocketAddress localAddress, final BGPSessionListener sessionListener, final BgpParameters bgpParameters) {
final AsNumber as = arguments.getAs();
final BGPSessionPreferences proposal = new BGPSessionPreferences(as, arguments.getHoldTimer(), new BgpId(localAddress.getAddress().getHostAddress()), as, Collections.singletonList(bgpParameters), Optional.empty());
final BGPPeerRegistry strictBGPPeerRegistry = dispatcher.getBGPPeerRegistry();
if (arguments.getInitiateConnection()) {
for (final InetSocketAddress remoteAddress : arguments.getRemoteAddresses()) {
strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener, proposal);
addFutureListener(localAddress, ((BGPDispatcherImpl) dispatcher).createClient(localAddress, remoteAddress, RETRY_TIMER, true));
}
} else {
for (final InetSocketAddress remoteAddress : arguments.getRemoteAddresses()) {
strictBGPPeerRegistry.addPeer(StrictBGPPeerRegistry.getIpAddress(remoteAddress), sessionListener, proposal);
}
addFutureListener(localAddress, dispatcher.createServer(localAddress));
}
LOG.debug("{} {}", sessionListener, proposal);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.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), 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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.Arguments in project bgpcep by opendaylight.
the class TunnelProgrammingTest method testTunnelProgramming.
@Test
public void testTunnelProgramming() throws TransactionCommitFailedException {
final Bandwidth bwd = new Bandwidth(new byte[] { 0x00, 0x00, 0x00, (byte) 0xff });
final ClassType classType = new ClassType((short) 1);
final String tunnelName = "create-tunnel";
final NetworkTopologyRef topologyRef = new NetworkTopologyRef(TOPO_IID);
// create tunnel
final PcepCreateP2pTunnelInputBuilder createInputBuilder = new PcepCreateP2pTunnelInputBuilder();
createInputBuilder.setDestination(new DestinationBuilder().setNode(NODE2_ID).setTp(TP2_ID).build());
createInputBuilder.setSource(new SourceBuilder().setNode(NODE1_ID).setTp(TP1_ID).build());
createInputBuilder.setNetworkTopologyRef(topologyRef);
createInputBuilder.setBandwidth(bwd);
createInputBuilder.setClassType(classType);
createInputBuilder.setSymbolicPathName(tunnelName);
createInputBuilder.setExplicitHops(Lists.newArrayList());
createInputBuilder.addAugmentation(PcepCreateP2pTunnelInput1.class, new PcepCreateP2pTunnelInput1Builder().setAdministrativeStatus(AdministrativeStatus.Active).build());
this.tunnelProgramming.pcepCreateP2pTunnel(createInputBuilder.build());
// check add-lsp input
Assert.assertNotNull(this.addLspInput);
Assert.assertEquals(tunnelName, this.addLspInput.getName());
final Arguments agrs = this.addLspInput.getArguments();
Assert.assertNotNull(agrs);
Assert.assertEquals(bwd, agrs.getBandwidth().getBandwidth());
Assert.assertEquals(classType, agrs.getClassType().getClassType());
final Ipv4 ipv4Endpoints = ((Ipv4Case) agrs.getEndpointsObj().getAddressFamily()).getIpv4();
Assert.assertEquals(NODE1_IPV4, ipv4Endpoints.getSourceIpv4Address().getValue());
Assert.assertEquals(NODE2_IPV4, ipv4Endpoints.getDestinationIpv4Address().getValue());
Assert.assertEquals(NODE1_ID.getValue(), this.addLspInput.getNode().getValue());
createLink();
// update tunnel
final PcepUpdateTunnelInputBuilder updateInputBuilder = new PcepUpdateTunnelInputBuilder();
updateInputBuilder.setNetworkTopologyRef(topologyRef);
updateInputBuilder.setBandwidth(bwd);
updateInputBuilder.setClassType(classType);
updateInputBuilder.setExplicitHops(Lists.newArrayList(createExplicitHop(IPV4_PREFIX1), createExplicitHop(IPV4_PREFIX2)));
updateInputBuilder.setLinkId(LINK1_ID);
updateInputBuilder.addAugmentation(PcepUpdateTunnelInput1.class, new PcepUpdateTunnelInput1Builder().setAdministrativeStatus(AdministrativeStatus.Active).build());
this.tunnelProgramming.pcepUpdateTunnel(updateInputBuilder.build());
// check update-lsp input
Assert.assertNotNull(this.updateLspInput);
Assert.assertEquals(LINK1_ID.getValue(), this.updateLspInput.getName());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.update.lsp.args.Arguments updArgs = this.updateLspInput.getArguments();
Assert.assertEquals(2, updArgs.getEro().getSubobject().size());
final List<Subobject> subObjects = updArgs.getEro().getSubobject();
final IpPrefixCase prefix1 = (IpPrefixCase) subObjects.get(0).getSubobjectType();
final IpPrefixCase prefix2 = (IpPrefixCase) subObjects.get(1).getSubobjectType();
Assert.assertEquals(IPV4_PREFIX1, prefix1.getIpPrefix().getIpPrefix().getIpv4Prefix().getValue());
Assert.assertEquals(IPV4_PREFIX2, prefix2.getIpPrefix().getIpPrefix().getIpv4Prefix().getValue());
// delete tunnel
final PcepDestroyTunnelInputBuilder destroyInputBuilder = new PcepDestroyTunnelInputBuilder();
destroyInputBuilder.setLinkId(LINK1_ID);
destroyInputBuilder.setNetworkTopologyRef(topologyRef);
this.tunnelProgramming.pcepDestroyTunnel(destroyInputBuilder.build());
Assert.assertNotNull(this.removeLspInput);
Assert.assertEquals(LINK1_ID.getValue(), this.removeLspInput.getName());
Assert.assertEquals(NODE1_ID.getValue(), this.removeLspInput.getNode().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.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;
}
Aggregations