Search in sources :

Example 1 with Arguments

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();
}
Also used : LspaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.LspaBuilder) Arguments2Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments2Builder) PcepCreateP2pTunnelInput1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcepCreateP2pTunnelInput1) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) ArgumentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.ArgumentsBuilder) AdministrativeStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.AdministrativeStatus) ClassTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.classtype.object.ClassTypeBuilder) EndpointsObjBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObjBuilder) BandwidthBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder)

Example 2 with Arguments

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);
}
Also used : BGPSessionPreferences(org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences) BgpId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId) BGPPeerRegistry(org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry) StrictBGPPeerRegistry(org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry) InetSocketAddress(java.net.InetSocketAddress) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)

Example 3 with Arguments

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);
}
Also used : BGPSessionListener(org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener) BGPDispatcher(org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher) LinkstateSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateSubsequentAddressFamily) Ipv4AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily) InetSocketAddress(java.net.InetSocketAddress) LinkstateAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateAddressFamily) BgpParameters(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters) OptionalCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.bgp.parameters.OptionalCapabilities) InetAddress(java.net.InetAddress) UnicastSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily)

Example 4 with Arguments

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());
}
Also used : NetworkTopologyRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.topology.rev140113.NetworkTopologyRef) PcepUpdateTunnelInput1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcepUpdateTunnelInput1Builder) IpPrefixCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase) Bandwidth(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth) PcepCreateP2pTunnelInput1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcepCreateP2pTunnelInput1Builder) PcepUpdateTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepUpdateTunnelInputBuilder) Ipv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv4Case) PcepDestroyTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepDestroyTunnelInputBuilder) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject) SourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.programming.rev130930.create.p2p.tunnel.input.SourceBuilder) Ipv4(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.ipv4._case.Ipv4) Arguments(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.Arguments) PcepCreateP2pTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev131030.PcepCreateP2pTunnelInputBuilder) ClassType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ClassType) DestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.programming.rev130930.create.p2p.tunnel.input.DestinationBuilder) AbstractConcurrentDataBrokerTest(org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest) Test(org.junit.Test)

Example 5 with Arguments

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;
}
Also used : SingleTransactionDataBroker.syncReadOptional(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker.syncReadOptional) Optional(com.google.common.base.Optional) VpnPortipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPort) VpnPortipToPortKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPortKey) NeutronVpnPortipPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.NeutronVpnPortipPortData) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort) LearntVpnVipToPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortData) LearntVpnVipToPortKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPortKey)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)2 ArrayList (java.util.ArrayList)2 Optional (com.google.common.base.Optional)1 InetAddress (java.net.InetAddress)1 Test (org.junit.Test)1 AbstractConcurrentDataBrokerTest (org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest)1 SingleTransactionDataBroker.syncReadOptional (org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker.syncReadOptional)1 ItmTepAddWorker (org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker)1 ItmTepRemoveWorker (org.opendaylight.genius.itm.confighelpers.ItmTepRemoveWorker)1 StrictBGPPeerRegistry (org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry)1 BGPDispatcher (org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher)1 BGPPeerRegistry (org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry)1 BGPSessionPreferences (org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences)1 BGPSessionListener (org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener)1 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 FlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder)1 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)1 TunnelEndPoints (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints)1 TzMembership (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.tunnel.end.points.TzMembership)1 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)1