use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements in project netvirt by opendaylight.
the class LogicalSwitchesCmdTest method getData.
HwvtepGlobalAugmentation getData(LogicalSwitches[] elements) {
HwvtepGlobalAugmentationBuilder newDataBuilder = new HwvtepGlobalAugmentationBuilder();
List<LogicalSwitches> ls = new ArrayList<>();
for (LogicalSwitches ele : elements) {
ls.add(ele);
}
newDataBuilder.setLogicalSwitches(ls);
return newDataBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements in project netvirt by opendaylight.
the class NeutronTrunkChangeListener method deleteSubPortInterface.
private void deleteSubPortInterface(SubPorts subPort) {
String portName = subPort.getPortId().getValue();
InstanceIdentifier<Interface> interfaceIdentifier = NeutronvpnUtils.buildVlanInterfaceIdentifier(subPort.getPortId().getValue());
jobCoordinator.enqueueJob("PORT- " + portName, () -> {
Interface iface = ifMgr.getInterfaceInfoFromConfigDataStore(portName);
List<ListenableFuture<Void>> futures = new ArrayList<>();
if (iface == null) {
LOG.warn("Interface not present for SubPort {}", subPort);
return futures;
}
/*
* We'll reset interface back to way it was? Can IFM handle parentRef delete?
*/
InterfaceBuilder interfaceBuilder = new InterfaceBuilder(iface);
// Reset augmentations
interfaceBuilder.removeAugmentation(IfL2vlan.class).removeAugmentation(ParentRefs.class).removeAugmentation(SplitHorizon.class);
IfL2vlan ifL2vlan = new IfL2vlanBuilder().setL2vlanMode(IfL2vlan.L2vlanMode.Trunk).build();
interfaceBuilder.addAugmentation(IfL2vlan.class, ifL2vlan);
iface = interfaceBuilder.build();
/*
* There is no means to do an update to remove elements from a node.
* Our solution is to get existing iface, remove parentRef and VlanId,
* and do a put to replace existing entry. This works out better as put
* has better performance than merge.
* Only drawback is any in-flight changes might be lost, but that is a corner case
* and this being subport delete path, don't expect any significant changes to
* corresponding Neutron Port. Deletion of NeutronPort should follow soon enough.
*/
WriteTransaction txn = dataBroker.newWriteOnlyTransaction();
txn.put(LogicalDatastoreType.CONFIGURATION, interfaceIdentifier, iface);
LOG.trace("Resetting trunk member interface {}", iface);
futures.add(txn.submit());
return futures;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements in project controller by opendaylight.
the class BaListBuilder method buildInnerList.
private static List<InnerList> buildInnerList(final int index, final int elements) {
List<InnerList> innerList = new ArrayList<>(elements);
final String itemStr = "Item-" + String.valueOf(index) + "-";
for (int i = 0; i < elements; i++) {
innerList.add(new InnerListBuilder().setKey(new InnerListKey(i)).setName(i).setValue(itemStr + String.valueOf(i)).build());
}
return innerList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements in project bgpcep by opendaylight.
the class AsPathPrepend method applyExportAction.
@Override
public Attributes applyExportAction(final RouteEntryBaseAttributes routeEntryInfo, final BGPRouteEntryExportParameters exportParameters, final Attributes attributes, final SetAsPathPrepend actions) {
final List<Segments> oldSegments = attributes.getAsPath().getSegments();
/*
* We need to check the first segment.
* If it has as-set then new as-sequence with local AS is prepended.
* If it has as-sequence, we may add local AS when it has less than 255 elements.
* Otherwise we need to create new as-sequence for local AS.
*/
final ArrayList<AsNumber> newAsSequence = new ArrayList<>();
newAsSequence.add(new AsNumber(routeEntryInfo.getLocalAs()));
List<Segments> newSegments = new ArrayList<>();
if (oldSegments == null || oldSegments.isEmpty()) {
newSegments = Collections.singletonList(new SegmentsBuilder().setAsSequence(newAsSequence).build());
} else {
final Segments firstSegment = oldSegments.remove(0);
final List<AsNumber> firstAsSequence = firstSegment.getAsSequence();
if (firstAsSequence != null && firstAsSequence.size() < Values.UNSIGNED_BYTE_MAX_VALUE) {
newAsSequence.addAll(firstAsSequence);
newSegments.add(new SegmentsBuilder().setAsSequence(newAsSequence).build());
} else {
newSegments.add(new SegmentsBuilder().setAsSequence(newAsSequence).build());
newSegments.add(firstSegment);
}
newSegments.addAll(oldSegments);
}
return new AttributesBuilder(attributes).setAsPath(new AsPathBuilder().setSegments(newSegments).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements in project genius by opendaylight.
the class OvsdbTepRemoveConfigHelper method removeUnknownTzTepFromTepsNotHosted.
/**
* Removes the TEP from the not-hosted transport zone in the TepsNotHosted list
* from ITM Operational Datastore.
*
* @param tzName transport zone name in string
* @param tepIpAddress TEP IP address in IpAddress object
* @param dpnId bridge datapath ID in BigInteger
* @param dataBroker data broker handle to perform operations on operational datastore
* @param wrTx WriteTransaction object
*/
public static void removeUnknownTzTepFromTepsNotHosted(String tzName, IpAddress tepIpAddress, BigInteger dpnId, DataBroker dataBroker, WriteTransaction wrTx) {
List<UnknownVteps> vtepList = null;
TepsInNotHostedTransportZone tepsInNotHostedTransportZone = ItmUtils.getUnknownTransportZoneFromITMOperDS(tzName, dataBroker);
if (tepsInNotHostedTransportZone == null) {
LOG.trace("Unhosted TransportZone ({}) does not exist in OperDS. Nothing to do for TEP removal.", tzName);
return;
} else {
vtepList = tepsInNotHostedTransportZone.getUnknownVteps();
if (vtepList == null || vtepList.isEmpty()) {
// case: vtep list does not exist or it has no elements
LOG.trace("Remove TEP from unhosted TZ ({}) when no vtep-list in the TZ. Nothing to do.", tzName);
} else {
// case: vtep list has elements
boolean vtepFound = false;
UnknownVteps foundVtep = null;
for (UnknownVteps vtep : vtepList) {
if (vtep.getDpnId().equals(dpnId)) {
vtepFound = true;
foundVtep = vtep;
break;
}
}
if (vtepFound) {
// vtep is found, update it with tep-ip
LOG.trace("Remove TEP with IP ({}) from unhosted TZ ({}) inside not-hosted-transport-zones list.", tepIpAddress, tzName);
if (vtepList.size() == 1) {
removeTzFromTepsNotHosted(tzName, wrTx);
} else {
removeVtepFromTepsNotHosted(tzName, dpnId, wrTx);
}
vtepList.remove(foundVtep);
}
}
}
}
Aggregations