Search in sources :

Example 36 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project PublicCrafters by BananaPuncher714.

the class CustomInventoryCrafting method setItem.

@Override
public void setItem(int index, ItemStack item) {
    // Instead of updating one container, update all the containers
    // That are looking at the table, basically the viewers
    items[index] = item;
    for (Container container : containers) {
        container.a(this);
    }
    // Update the armorstand grid
    display.update();
}
Also used : Container(net.minecraft.server.v1_9_R2.Container) SelfContainer(io.github.bananapuncher714.crafters.implementation.v1_9_R2.ContainerManager_v1_9_R2.SelfContainer)

Example 37 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project tests by datanucleus.

the class BasicTest method testInh2.

public void testInh2() {
    try {
        PersistenceManager pm = pmf.getPersistenceManager();
        Transaction tx = pm.currentTransaction();
        try {
            tx.begin();
            Base base1 = new Base(1, "b1");
            Base base2 = new Base(2, "b2");
            Base base3 = new Base(3, "b3");
            SubBase group1 = new SubBase(4, "b4", "SB1");
            SubBase group2 = new SubBase(5, "b5", "SB2");
            Container c = new Container(new Base[] { base1, base2, base3, group1, group2 });
            pm.makePersistent(c);
            tx.commit();
            tx.begin();
            Collection col = (Collection) pm.newQuery(SubBase.class).execute();
            assertTrue(col.size() == 2);
            assertTrue(col.contains(group1));
            assertTrue(col.contains(group2));
            tx.commit();
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
            pm.close();
        }
    } finally {
        clean(Container.class);
        clean(SubBase.class);
        clean(Base.class);
    }
}
Also used : SubBase(org.datanucleus.samples.metadata.inh2.SubBase) Container(org.datanucleus.samples.metadata.inh2.Container) Transaction(javax.jdo.Transaction) PersistenceManager(javax.jdo.PersistenceManager) Collection(java.util.Collection) Base(org.datanucleus.samples.metadata.inh2.Base) SubBase(org.datanucleus.samples.metadata.inh2.SubBase)

Example 38 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project genius by opendaylight.

the class TepCommandHelper method buildTeps.

@SuppressWarnings("checkstyle:IllegalCatch")
public void buildTeps() {
    TransportZone transportZone = null;
    try {
        LOG.debug("no of teps added {}", CHECK);
        if (transportZonesHashMap != null && !transportZonesHashMap.isEmpty()) {
            transportZoneArrayList = new ArrayList<>();
            for (Entry<String, List<Vteps>> mapEntry : transportZonesHashMap.entrySet()) {
                String tz = mapEntry.getKey();
                LOG.debug("transportZonesHashMap {}", tz);
                List<Vteps> vtepListTemp = mapEntry.getValue();
                InstanceIdentifier<TransportZone> transportZonePath = InstanceIdentifier.builder(TransportZones.class).child(TransportZone.class, new TransportZoneKey(tz)).build();
                Optional<TransportZone> transportZoneOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, transportZonePath, dataBroker);
                LOG.debug("read container from DS");
                if (transportZoneOptional.isPresent()) {
                    TransportZone tzoneFromDs = transportZoneOptional.get();
                    LOG.debug("read tzone container {}", tzoneFromDs);
                    if (tzoneFromDs.getTunnelType() == null || tzoneFromDs.getTunnelType().equals(TunnelTypeVxlan.class)) {
                        transportZone = new TransportZoneBuilder().withKey(new TransportZoneKey(tz)).setTunnelType(TunnelTypeVxlan.class).setZoneName(tz).setVteps(vtepListTemp).build();
                    } else if (tzoneFromDs.getTunnelType().equals(TunnelTypeGre.class)) {
                        transportZone = new TransportZoneBuilder().withKey(new TransportZoneKey(tz)).setTunnelType(TunnelTypeGre.class).setVteps(vtepListTemp).setZoneName(tz).build();
                    }
                } else {
                    transportZone = new TransportZoneBuilder().withKey(new TransportZoneKey(tz)).setTunnelType(TunnelTypeVxlan.class).setZoneName(tz).setVteps(vtepListTemp).build();
                }
                LOG.debug("tzone object {}", transportZone);
                transportZoneArrayList.add(transportZone);
            }
            TransportZones transportZones = new TransportZonesBuilder().setTransportZone(transportZoneArrayList.stream().collect(Collectors.toList())).build();
            InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
            LOG.debug("InstanceIdentifier {}", path);
            Futures.addCallback(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> tx.mergeParentStructureMerge(path, transportZones)), ItmUtils.DEFAULT_WRITE_CALLBACK, MoreExecutors.directExecutor());
            LOG.debug("wrote to Config DS {}", transportZones);
            transportZonesHashMap.clear();
            transportZoneArrayList.clear();
            LOG.debug("Everything cleared");
        } else {
            LOG.debug("NO vteps were configured");
        }
    } catch (RuntimeException e) {
        LOG.error("Error building TEPs", e);
    }
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) VtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.VtepsKey) OfTep(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.of.teps.state.OfTep) TransportZoneBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder) LoggerFactory(org.slf4j.LoggerFactory) TepTypeInternal(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TepTypeInternal) StringUtils(org.apache.commons.lang3.StringUtils) StateTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList) TransportZonesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZonesBuilder) PreDestroy(javax.annotation.PreDestroy) TunnelMonitoringTypeLldp(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeLldp) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) RetryingManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.RetryingManagedNewTransactionRunner) Map(java.util.Map) TunnelTypeGre(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeGre) Datastore(org.opendaylight.mdsal.binding.util.Datastore) TunnelTypeLogicalGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Vteps) Collection(java.util.Collection) TunnelTypeMplsOverGre(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeMplsOverGre) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) TunnelTypeBase(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase) TunnelOperStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelOperStatus) Entry(java.util.Map.Entry) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) Uint64(org.opendaylight.yangtools.yang.common.Uint64) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) ArrayList(java.util.ArrayList) TunnelMonitoringTypeBfd(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBfd) Inject(javax.inject.Inject) TunnelMonitorIntervalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) UnprocessedTunnelsStateCache(org.opendaylight.genius.itm.cache.UnprocessedTunnelsStateCache) TunnelMonitoringTypeBase(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBase) TunnelMonitorParamsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParamsBuilder) TunnelMonitorParams(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParams) OvsdbBridgeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeRef) Logger(org.slf4j.Logger) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) VtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.VtepsBuilder) TunnelMonitorInterval(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval) ExecutionException(java.util.concurrent.ExecutionException) Futures(com.google.common.util.concurrent.Futures) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) ITMConstants(org.opendaylight.genius.itm.globals.ITMConstants) Collections(java.util.Collections) ItmUtils(org.opendaylight.genius.itm.impl.ItmUtils) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) IpAddressBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder) TunnelTypeGre(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeGre) TransportZonesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZonesBuilder) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Vteps) TransportZoneBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder) StateTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList) List(java.util.List) ArrayList(java.util.ArrayList) TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)

Example 39 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project lispflowmapping by opendaylight.

the class MapResolver method updateLocators.

// Process locators according to configured policy
private MappingRecord updateLocators(MappingRecord mapping, List<ItrRloc> itrRlocs) {
    // no fixing if elpPolicy is default
    if (elpPolicy.equalsIgnoreCase("default")) {
        return mapping;
    }
    List<LocatorRecord> locatorRecords = mapping.getLocatorRecord();
    // if no updated is needed, just return the mapping
    if (!locatorsNeedFixing(locatorRecords)) {
        return mapping;
    }
    MappingRecordBuilder recordBuilder = new MappingRecordBuilder(mapping);
    recordBuilder.setLocatorRecord(new ArrayList<LocatorRecord>());
    try {
        for (LocatorRecord record : locatorRecords) {
            Rloc container = record.getRloc();
            // done
            if (!(container.getAddress() instanceof ExplicitLocatorPath) || elpPolicy.equalsIgnoreCase("default") || itrRlocs == null) {
                recordBuilder.getLocatorRecord().add(new LocatorRecordBuilder().setLocalLocator(record.getLocalLocator()).setRlocProbed(record.getRlocProbed()).setWeight(record.getWeight()).setPriority(record.getPriority()).setMulticastWeight(record.getMulticastWeight()).setMulticastPriority(record.getMulticastPriority()).setRouted(record.getRouted()).setRloc(container).setLocatorId(record.getLocatorId()).build());
                continue;
            }
            ExplicitLocatorPath teAddress = (ExplicitLocatorPath) container.getAddress();
            SimpleAddress nextHop = getNextELPHop(teAddress, itrRlocs);
            if (nextHop != null) {
                java.lang.Short priority = record.getPriority().toJava();
                if (elpPolicy.equalsIgnoreCase("both")) {
                    recordBuilder.getLocatorRecord().add(new LocatorRecordBuilder().setLocalLocator(record.getLocalLocator()).setRlocProbed(record.getRlocProbed()).setWeight(record.getWeight()).setPriority(record.getPriority()).setMulticastWeight(record.getMulticastWeight()).setMulticastPriority(record.getMulticastPriority()).setRouted(record.getRouted()).setRloc(container).setLocatorId(record.getLocatorId()).build());
                    // XXX Complex cases like several ELPs with different priorities are not handled
                    if (priority != 254 || priority != 255) {
                        priority++;
                    }
                }
                // Build and add the simple RLOC
                recordBuilder.getLocatorRecord().add(new LocatorRecordBuilder().setLocalLocator(record.getLocalLocator()).setRlocProbed(record.getRlocProbed()).setWeight(record.getWeight()).setPriority(fromJava(priority)).setMulticastWeight(record.getMulticastWeight()).setMulticastPriority(record.getMulticastPriority()).setRouted(record.getRouted()).setRloc(LispAddressUtil.toRloc(nextHop)).setLocatorId(record.getLocatorId()).build());
            }
        }
    } catch (ClassCastException cce) {
        LOG.error("Class Cast Exception while building EidToLocatorRecord: {}", ExceptionUtils.getStackTrace(cce));
    }
    return recordBuilder.build();
}
Also used : LocatorRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecordBuilder) MappingRecordBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecordBuilder) Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) ItrRloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc) SimpleAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress) LocatorRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord) ExplicitLocatorPath(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.ExplicitLocatorPath)

Example 40 with Container

use of org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.Container in project netconf by opendaylight.

the class AbstractNetconfTopology method hideCredentials.

/**
 * Hiding of private credentials from node configuration (credentials data is replaced by asterisks).
 *
 * @param nodeConfiguration Node configuration container.
 * @return String representation of node configuration with credentials replaced by asterisks.
 */
@VisibleForTesting
public static String hideCredentials(final Node nodeConfiguration) {
    final NetconfNode netconfNodeAugmentation = nodeConfiguration.augmentation(NetconfNode.class);
    final String nodeCredentials = netconfNodeAugmentation.getCredentials().toString();
    final String nodeConfigurationString = nodeConfiguration.toString();
    return nodeConfigurationString.replace(nodeCredentials, "***");
}
Also used : NetconfNode(org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

ItemStack (org.bukkit.inventory.ItemStack)45 Test (org.junit.Test)16 HashMap (java.util.HashMap)10 Container (net.minecraft.server.v1_12_R1.Container)9 Container (net.minecraft.server.v1_16_R3.Container)9 Container (org.flyte.api.v1.Container)9 FailedNbt (com.ruinscraft.panilla.api.exception.FailedNbt)8 INbtTagCompound (com.ruinscraft.panilla.api.nbt.INbtTagCompound)8 Container (net.minecraft.server.v1_11_R1.Container)8 Container (net.minecraft.server.v1_14_R1.Container)8 Container (net.minecraft.server.v1_15_R1.Container)8 Container (net.minecraft.server.v1_16_R1.Container)8 Container (net.minecraft.server.v1_16_R2.Container)8 Container (net.minecraft.server.v1_8_R3.Container)8 ByteBuf (io.netty.buffer.ByteBuf)7 ArrayList (java.util.ArrayList)7 Container (net.minecraft.server.v1_13_R1.Container)7 Container (net.minecraft.server.v1_13_R2.Container)6 Container (net.minecraft.server.v1_10_R1.Container)5 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)5