use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.
the class ElanBridgeManager method buildBridgeOtherConfigs.
private List<BridgeOtherConfigs> buildBridgeOtherConfigs(Node ovsdbNode, String bridgeName, String mac) {
// First attempt to extract the bridge augmentation from operational...
Node bridgeNode = southboundUtils.getBridgeNode(ovsdbNode, bridgeName);
OvsdbBridgeAugmentation bridgeAug = null;
if (bridgeNode != null) {
bridgeAug = southboundUtils.extractBridgeAugmentation(bridgeNode);
}
// ...if present, it means this bridge already exists and we need to take
// care not to change the datapath id. We do this by explicitly setting
// other_config:datapath-id to the value reported in the augmentation.
List<BridgeOtherConfigs> otherConfigs;
if (bridgeAug != null) {
DatapathId dpId = bridgeAug.getDatapathId();
if (dpId != null) {
otherConfigs = bridgeAug.getBridgeOtherConfigs();
if (otherConfigs == null) {
otherConfigs = Lists.newArrayList();
}
if (otherConfigs.stream().noneMatch(otherConfig -> otherConfig.getBridgeOtherConfigKey().equals(OTHER_CONFIG_DATAPATH_ID))) {
String dpIdVal = dpId.getValue().replace(":", "");
otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_DATAPATH_ID).setBridgeOtherConfigValue(dpIdVal).build());
}
} else {
otherConfigs = Lists.newArrayList();
}
} else {
otherConfigs = Lists.newArrayList();
if (mac != null) {
otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_HWADDR).setBridgeOtherConfigValue(mac).build());
}
}
if (otherConfigs.stream().noneMatch(otherConfig -> otherConfig.getBridgeOtherConfigKey().equals(OTHER_CONFIG_DISABLE_IN_BAND))) {
otherConfigs.add(new BridgeOtherConfigsBuilder().setBridgeOtherConfigKey(OTHER_CONFIG_DISABLE_IN_BAND).setBridgeOtherConfigValue("true").build());
}
return otherConfigs;
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.
the class ElanDpnInterfaceClusteredListener method add.
@Override
protected void add(InstanceIdentifier<DpnInterfaces> identifier, final DpnInterfaces dpnInterfaces) {
final String elanName = getElanName(identifier);
jobCoordinator.enqueueJob(elanName + ":l2gw", () -> {
elanInstanceDpnsCache.add(getElanName(identifier), dpnInterfaces);
if (entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
ElanInstance elanInstance = elanInstanceCache.get(elanName).orNull();
if (elanInstance != null) {
elanL2GatewayUtils.installElanL2gwDevicesLocalMacsInDpn(dpnInterfaces.getDpId(), elanInstance, dpnInterfaces.getInterfaces().get(0));
// updating remote mcast mac on l2gw devices
elanL2GatewayMulticastUtils.updateRemoteMcastMacOnElanL2GwDevices(elanName);
}
}
return null;
});
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.
the class ElanInterfaceManager method createElanInterfaceTablesList.
private void createElanInterfaceTablesList(String interfaceName, WriteTransaction tx) {
InstanceIdentifier<ElanInterfaceMac> elanInterfaceMacTables = ElanUtils.getElanInterfaceMacEntriesOperationalDataPath(interfaceName);
Optional<ElanInterfaceMac> interfaceMacTables = ElanUtils.read(broker, LogicalDatastoreType.OPERATIONAL, elanInterfaceMacTables);
// Static-Mac Entries..
if (!interfaceMacTables.isPresent()) {
ElanInterfaceMac elanInterfaceMacTable = new ElanInterfaceMacBuilder().setElanInterface(interfaceName).setKey(new ElanInterfaceMacKey(interfaceName)).build();
tx.put(LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanInterfaceMacEntriesOperationalDataPath(interfaceName), elanInterfaceMacTable, WriteTransaction.CREATE_MISSING_PARENTS);
}
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.
the class ElanInterfaceManager method update.
/*
* Possible Scenarios for update
* a. if orig={1,2,3,4} and updated=null or updated={}
then all {1,2,3,4} should be removed
b. if orig=null or orig={} and updated ={1,2,3,4}
then all {1,2,3,4} should be added
c. if orig = {1,2,3,4} updated={2,3,4}
then 1 should be removed
d. basically if orig = { 1,2,3,4} and updated is {1,2,3,4,5}
then we should just add 5
e. if orig = {1,2,3,4} updated={2,3,4,5}
then 1 should be removed , 5 should be added
* */
@Override
protected void update(InstanceIdentifier<ElanInterface> identifier, ElanInterface original, ElanInterface update) {
// updating the static-Mac Entries for the existing elanInterface
String elanName = update.getElanInstanceName();
String interfaceName = update.getName();
List<StaticMacEntries> originalStaticMacEntries = original.getStaticMacEntries();
List<StaticMacEntries> updatedStaticMacEntries = update.getStaticMacEntries();
List<StaticMacEntries> deletedEntries = ElanUtils.diffOf(originalStaticMacEntries, updatedStaticMacEntries);
List<StaticMacEntries> updatedEntries = ElanUtils.diffOf(updatedStaticMacEntries, originalStaticMacEntries);
deletedEntries.forEach((deletedEntry) -> removeInterfaceStaticMacEntries(elanName, interfaceName, deletedEntry.getMacAddress()));
/*if updatedStaticMacEntries is NOT NULL, which means as part of update call these entries were added.
* Hence add the macentries for the same.*/
for (StaticMacEntries staticMacEntry : updatedEntries) {
InstanceIdentifier<MacEntry> macEntryIdentifier = getMacEntryOperationalDataPath(elanName, staticMacEntry.getMacAddress());
Optional<MacEntry> existingMacEntry = ElanUtils.read(broker, LogicalDatastoreType.OPERATIONAL, macEntryIdentifier);
WriteTransaction tx = broker.newWriteOnlyTransaction();
if (existingMacEntry.isPresent()) {
elanForwardingEntriesHandler.updateElanInterfaceForwardingTablesList(elanName, interfaceName, existingMacEntry.get().getInterface(), existingMacEntry.get(), tx);
} else {
elanForwardingEntriesHandler.addElanInterfaceForwardingTableList(elanName, interfaceName, staticMacEntry, tx);
}
ElanUtils.waitForTransactionToComplete(tx);
}
}
use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.
the class ElanServiceProvider method createEtreeInstance.
@Override
public boolean createEtreeInstance(String elanInstanceName, long macTimeout, String description) {
Optional<ElanInstance> existingElanInstance = elanInstanceCache.get(elanInstanceName);
boolean isSuccess = true;
if (existingElanInstance.isPresent()) {
if (compareWithExistingElanInstance(existingElanInstance.get(), macTimeout, description)) {
LOG.warn("Etree Instance is already present in the Operational DS {}", existingElanInstance);
return true;
} else {
EtreeInstance etreeInstance = new EtreeInstanceBuilder().build();
ElanInstance updateElanInstance = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName).setDescription(description).setMacTimeout(macTimeout).setKey(new ElanInstanceKey(elanInstanceName)).addAugmentation(EtreeInstance.class, etreeInstance).build();
MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName), updateElanInstance);
LOG.debug("Updating the Etree Instance {} with MAC TIME-OUT {} and Description {} ", updateElanInstance, macTimeout, description);
}
} else {
EtreeInstance etreeInstance = new EtreeInstanceBuilder().build();
ElanInstance elanInstance = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName).setMacTimeout(macTimeout).setDescription(description).setKey(new ElanInstanceKey(elanInstanceName)).addAugmentation(EtreeInstance.class, etreeInstance).build();
MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName), elanInstance);
LOG.debug("Creating the new Etree Instance {}", elanInstance);
}
return isSuccess;
}
Aggregations