use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.
the class ElanInterfaceManager method setupLeavesLocalBroadcastGroups.
private void setupLeavesLocalBroadcastGroups(ElanInstance elanInfo, DpnInterfaces newDpnInterface, InterfaceInfo interfaceInfo) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
List<String> interfaces = new ArrayList<>();
if (newDpnInterface != null) {
interfaces = newDpnInterface.getInterfaces();
}
for (String ifName : interfaces) {
// In case if there is a InterfacePort in the cache which is not
// in
// operational state, skip processing it
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(ifName, interfaceInfo.getInterfaceType());
if (!isOperational(ifInfo)) {
continue;
}
if (!interfaceManager.isExternalInterface(ifName)) {
// only add root interfaces
bucketId = addInterfaceIfRootInterface(bucketId, ifName, listBucket, ifInfo);
}
}
if (listBucket.isEmpty()) {
// No Buckets
createDropBucket(listBucket);
}
long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
long groupId = ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("installing the localBroadCast Group:{}", group);
mdsalManager.syncInstallGroup(interfaceInfo.getDpId(), group);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.
the class ElanInterfaceManager method removeLeavesLocalBroadcastGroup.
private void removeLeavesLocalBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
BigInteger dpnId = interfaceInfo.getDpId();
long groupId = ElanUtils.getEtreeLeafLocalBCGId(etreeInstance.getEtreeLeafTagVal().getValue());
List<Bucket> listBuckets = new ArrayList<>();
int bucketId = 0;
listBuckets.add(getLocalBCGroupBucketInfo(interfaceInfo, bucketId));
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
LOG.trace("deleted the localBroadCast Group:{}", group);
mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance 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;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method setupLeavesEtreeBroadcastGroups.
public void setupLeavesEtreeBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
int actionKey = 0;
List<Action> listAction = new ArrayList<>();
listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag)).buildAction(++actionKey));
listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId, etreeLeafTag);
listBucket.addAll(listBucketInfoRemote);
long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeLeafTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("Installing the remote BroadCast Group:{}", group);
mdsalManager.syncInstallGroup(dpnId, group);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.
the class EtreeGet method doExecute.
@Override
protected Object doExecute() {
LOG.debug("Executing Get EtreeInstance command for {}", etreeName);
if (etreeName != null) {
ElanInstance elanInstance = elanProvider.getElanInstance(etreeName);
if (elanInstance == null || elanInstance.getAugmentation(EtreeInstance.class) == null) {
session.getConsole().println("No Etree Instance present with name:" + etreeName);
} else {
session.getConsole().println(getEtreeHeaderOutput());
session.getConsole().println(String.format(ElanCLIUtils.ETREE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getDescription()));
}
} else {
List<ElanInstance> elanInstanceList = elanProvider.getElanInstances();
if (elanInstanceList != null && !elanInstanceList.isEmpty()) {
session.getConsole().println(getEtreeHeaderOutput());
for (ElanInstance elanInstance : elanInstanceList) {
if (elanInstance.getAugmentation(EtreeInstance.class) != null) {
session.getConsole().println(String.format(ElanCLIUtils.ETREE_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getAugmentation(EtreeInstance.class).getEtreeLeafTagVal().getValue(), elanInstance.getDescription()));
}
}
} else {
session.getConsole().println("No Etree Instances are present");
}
}
return null;
}
Aggregations