Search in sources :

Example 71 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project netvirt by opendaylight.

the class NeutronFloatingToFixedIpMappingChangeListener method remove.

@Override
public void remove(InstanceIdentifier<Floatingip> identifier, Floatingip input) {
    LOG.trace("Neutron Floating IP deleted : key: {}, value={}", identifier, input);
    IpAddress fixedIp = input.getFixedIpAddress();
    if (fixedIp != null) {
        // update FloatingIpPortInfo to set isFloatingIpDeleted as true to enable deletion of FloatingIpPortInfo
        // map once it is used for processing in the NAT removal path
        updateFloatingIpPortInfo(input.getUuid(), input.getPortId());
        clearFromFloatingIpInfo(input.getRouterId().getValue(), input.getPortId().getValue(), fixedIp.getIpv4Address().getValue());
    } else {
        // delete FloatingIpPortInfo mapping since floating IP is deleted and no fixed IP is associated to it
        removeFromFloatingIpPortInfo(input.getUuid());
    }
}
Also used : IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 72 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class LearningSwitchHandlerSimpleImpl method addBridgeFlow.

private void addBridgeFlow(MacAddress srcMac, MacAddress dstMac, NodeConnectorRef destNodeConnector) {
    synchronized (coveredMacPaths) {
        String macPath = srcMac.toString() + dstMac.toString();
        if (!coveredMacPaths.contains(macPath)) {
            LOG.debug("covering mac path: {} by [{}]", macPath, destNodeConnector.getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId());
            coveredMacPaths.add(macPath);
            FlowId flowId = new FlowId(String.valueOf(flowIdInc.getAndIncrement()));
            FlowKey flowKey = new FlowKey(flowId);
            /**
             * Path to the flow we want to program.
             */
            InstanceIdentifier<Flow> flowPath = InstanceIdentifierUtils.createFlowPath(tablePath, flowKey);
            Short tableId = InstanceIdentifierUtils.getTableId(tablePath);
            FlowBuilder srcToDstFlow = FlowUtils.createDirectMacToMacFlow(tableId, DIRECT_FLOW_PRIORITY, srcMac, dstMac, destNodeConnector);
            srcToDstFlow.setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement())));
            dataStoreAccessor.writeFlowToConfig(flowPath, srcToDstFlow.build());
        }
    }
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) FlowCookie(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 73 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project openflowplugin by opendaylight.

the class MeterConvertorTest method testMeterModCommandConvertorNoValidBandData.

@Test
public void testMeterModCommandConvertorNoValidBandData() {
    // / DROP Band
    MeterBandHeaderBuilder meterBandHeaderBuilder = new MeterBandHeaderBuilder();
    MeterBandTypesBuilder meterBandTypesB = new MeterBandTypesBuilder();
    MeterBandType bandFlag = new MeterBandType(true, false, false);
    // _ofpmbtDrop
    meterBandTypesB.setFlags(bandFlag);
    meterBandHeaderBuilder.setMeterBandTypes(meterBandTypesB.build());
    final MeterBandHeader meterBH = meterBandHeaderBuilder.build();
    // DSCP Mark
    MeterBandTypesBuilder meterBandTypesB1 = new MeterBandTypesBuilder();
    MeterBandType bandFlag1 = new MeterBandType(false, true, false);
    meterBandTypesB1.setFlags(bandFlag1);
    DscpRemarkBuilder dscp = new DscpRemarkBuilder();
    dscp.setDscpRemarkBurstSize(11L);
    dscp.setDscpRemarkRate(21L);
    dscp.setPrecLevel((short) 1);
    DscpRemark dscpRemark = dscp.build();
    MeterBandHeaderBuilder meterBandHeaderBuilder1 = new MeterBandHeaderBuilder();
    meterBandHeaderBuilder1.setBandType(dscpRemark);
    meterBandHeaderBuilder1.setMeterBandTypes(meterBandTypesB1.build());
    final MeterBandHeader meterBH1 = meterBandHeaderBuilder1.build();
    // Experimental
    ExperimenterBuilder exp = new ExperimenterBuilder();
    exp.setExperimenterBurstSize(12L);
    exp.setExperimenterRate(22L);
    exp.setExperimenter(23L);
    Experimenter experimenter = exp.build();
    MeterBandHeaderBuilder meterBandHeaderBuilder2 = new MeterBandHeaderBuilder();
    meterBandHeaderBuilder2.setBandType(experimenter);
    MeterBandTypesBuilder meterBandTypesB2 = new MeterBandTypesBuilder();
    meterBandHeaderBuilder2.setMeterBandTypes(meterBandTypesB2.build());
    MeterBandHeader meterBH2 = meterBandHeaderBuilder2.build();
    List<MeterBandHeader> meterBandList = new ArrayList<>();
    meterBandList.add(0, meterBH);
    meterBandList.add(1, meterBH1);
    meterBandList.add(2, meterBH2);
    // Constructing List of Bands
    MeterBandHeadersBuilder meterBandHeadersBuilder = new MeterBandHeadersBuilder();
    meterBandHeadersBuilder.setMeterBandHeader(meterBandList);
    MeterBandHeaders meterBandHeaders = meterBandHeadersBuilder.build();
    AddMeterInputBuilder addMeterFromSAL = new AddMeterInputBuilder();
    // MeterBands
    addMeterFromSAL.setMeterBandHeaders(meterBandHeaders);
    // NodeKey key = new NodeKey(new NodeId("24"));
    // InstanceIdentifier<Node> path =
    // InstanceIdentifier.builder().node(Nodes.class).node(Node.class,
    // key).build();
    addMeterFromSAL.setMeterId(new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(10L));
    MeterFlags flagV = new MeterFlags(true, true, true, true);
    addMeterFromSAL.setFlags(flagV);
    AddMeterInput meterInputCommand = addMeterFromSAL.build();
    MeterModInputBuilder outMeterModInput = convert(meterInputCommand, new VersionConvertorData((short) 0X4));
    assertEquals(MeterModCommand.OFPMCADD, outMeterModInput.getCommand());
    assertTrue(outMeterModInput.getFlags().isOFPMFBURST());
    assertEquals(Long.valueOf(10L), outMeterModInput.getMeterId().getValue());
    // BandInformation starts here:
    List<Bands> bands = outMeterModInput.getBands();
    for (Bands currentBand : bands) {
        MeterBand meterBand = currentBand.getMeterBand();
        if (meterBand instanceof MeterBandDropCase) {
            assertEquals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandType.OFPMBTDROP, ((MeterBandDropCase) meterBand).getMeterBandDrop().getType());
            assertEquals((long) 20, (long) ((MeterBandDropCase) meterBand).getMeterBandDrop().getBurstSize());
            assertEquals((long) 10, (long) ((MeterBandDropCase) meterBand).getMeterBandDrop().getRate());
        }
        if (meterBand instanceof MeterBandDscpRemarkCase) {
            assertEquals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandType.OFPMBTDSCPREMARK, ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getType());
            assertEquals((long) 11, (long) ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getBurstSize());
            assertEquals((long) 21, (long) ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getRate());
            assertEquals((short) 1, (short) ((MeterBandDscpRemarkCase) meterBand).getMeterBandDscpRemark().getPrecLevel());
        }
        if (meterBand instanceof MeterBandExperimenterCase) {
            assertEquals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterBandType.OFPMBTEXPERIMENTER, ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getType());
            assertEquals((long) 12, (long) ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getBurstSize());
            assertEquals((long) 22, (long) ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getRate());
            ExperimenterIdMeterBand expBand = ((MeterBandExperimenterCase) meterBand).getMeterBandExperimenter().getAugmentation(ExperimenterIdMeterBand.class);
            assertEquals((long) 23, (long) expBand.getExperimenter().getValue());
        }
    }
}
Also used : MeterBand(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.MeterBand) ExperimenterIdMeterBand(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMeterBand) DscpRemark(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemark) MeterModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder) ArrayList(java.util.ArrayList) MeterBandDscpRemarkCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDscpRemarkCase) AddMeterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput) MeterFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterFlags) MeterBandHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeader) DscpRemarkBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemarkBuilder) MeterBandType(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterBandType) MeterBandTypesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.meter.band.header.MeterBandTypesBuilder) Experimenter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Experimenter) MeterBandHeaderBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderBuilder) MeterBandHeaders(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.MeterBandHeaders) MeterBandExperimenterCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase) MeterBandDropCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandDropCase) VersionConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData) Bands(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.mod.Bands) MeterBandHeadersBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.MeterBandHeadersBuilder) ExperimenterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.ExperimenterBuilder) ExperimenterIdMeterBand(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMeterBand) AddMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder) Test(org.junit.Test)

Example 74 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project controller by opendaylight.

the class AbstractDataBrokerTestTest method writeInitialState.

// copy/pasted from Bug1125RegressionTest.writeInitialState()
private void writeInitialState() throws TransactionCommitFailedException {
    WriteTransaction initialTx = getDataBroker().newWriteOnlyTransaction();
    initialTx.put(LogicalDatastoreType.OPERATIONAL, TOP_PATH, new TopBuilder().build());
    TreeComplexUsesAugment fooAugment = new TreeComplexUsesAugmentBuilder().setContainerWithUses(new ContainerWithUsesBuilder().setLeafFromGrouping("foo").build()).build();
    initialTx.put(LogicalDatastoreType.OPERATIONAL, path(TOP_FOO_KEY), topLevelList(TOP_FOO_KEY, fooAugment));
    initialTx.submit().checkedGet();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) TopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.list.rev140701.TopBuilder) TreeComplexUsesAugment(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.TreeComplexUsesAugment) ContainerWithUsesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.complex.from.grouping.ContainerWithUsesBuilder) TreeComplexUsesAugmentBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.TreeComplexUsesAugmentBuilder)

Example 75 with Path

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcupd.message.pcupd.message.updates.Path in project controller by opendaylight.

the class RoutedServiceIT method createNodeRef.

/**
 * Returns node reference from string which represents path
 *
 * @param string
 *            string with key(path)
 * @return instance identifier to {@link UnorderedList}
 */
private static InstanceIdentifier<UnorderedList> createNodeRef(final String string) {
    final UnorderedListKey key = new UnorderedListKey(string);
    final InstanceIdentifier<UnorderedList> path = InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).child(UnorderedList.class, key).build();
    return path;
}
Also used : Lists(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.Lists) UnorderedList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.unordered.container.UnorderedList) UnorderedListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.unordered.container.UnorderedListKey)

Aggregations

ArrayList (java.util.ArrayList)53 Test (org.junit.Test)48 ExecutionException (java.util.concurrent.ExecutionException)26 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)21 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)20 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 Collections (java.util.Collections)18 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)18 ByteBuf (io.netty.buffer.ByteBuf)16 List (java.util.List)16 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)16 Logger (org.slf4j.Logger)16 LoggerFactory (org.slf4j.LoggerFactory)16 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)15 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)15 AsPathBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.AsPathBuilder)15 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)14 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)12 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)11