Search in sources :

Example 6 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.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(java.util.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)

Example 7 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.add.lsp.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());
}
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.rev200720.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.rev200720.PcepCreateP2pTunnelInput1Builder) PcepUpdateTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev181109.PcepUpdateTunnelInputBuilder) Ipv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.endpoints.address.family.Ipv4Case) PcepDestroyTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev181109.PcepDestroyTunnelInputBuilder) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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.rev181109.endpoints.address.family.ipv4._case.Ipv4) Arguments(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.add.lsp.args.Arguments) PcepCreateP2pTunnelInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.programming.rev181109.PcepCreateP2pTunnelInputBuilder) ClassType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.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.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest) Test(org.junit.Test)

Example 8 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.add.lsp.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);
}
Also used : ReportedLsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.ReportedLsp) Optional(java.util.Optional) Arguments(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.ensure.lsp.operational.args.Arguments) OperationalStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.OperationalStatus) Arguments1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Arguments1)

Example 9 with Arguments

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.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), 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);
}
Also used : Ipv6AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv6AddressFamily) BGPSessionListener(org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener) BGPDispatcher(org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher) L2vpnAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.L2vpnAddressFamily) MplsLabeledVpnSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.MplsLabeledVpnSubsequentAddressFamily) McastMplsLabeledVpnSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.McastMplsLabeledVpnSubsequentAddressFamily) LinkstateSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.LinkstateSubsequentAddressFamily) Ipv4AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily) InetSocketAddress(java.net.InetSocketAddress) LinkstateAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.LinkstateAddressFamily) EvpnSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.EvpnSubsequentAddressFamily) BgpParameters(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.BgpParameters) RouteTargetConstrainSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.RouteTargetConstrainSubsequentAddressFamily) OptionalCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.bgp.parameters.OptionalCapabilities) InetAddress(java.net.InetAddress) UnicastSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.UnicastSubsequentAddressFamily) McastMplsLabeledVpnSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.McastMplsLabeledVpnSubsequentAddressFamily)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)2 ArrayList (java.util.ArrayList)2 Optional (java.util.Optional)2 InetAddress (java.net.InetAddress)1 Test (org.junit.Test)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 AbstractConcurrentDataBrokerTest (org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest)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