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();
}
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);
}
}
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);
}
}
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();
}
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, "***");
}
Aggregations