use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface in project netvirt by opendaylight.
the class DhcpAllocationPoolManager method getNetworkByPort.
public String getNetworkByPort(String portUuid) throws ReadFailedException {
InstanceIdentifier<ElanInterface> elanInterfaceName = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface.class, new ElanInterfaceKey(portUuid)).build();
Optional<ElanInterface> optionalElanInterface = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, elanInterfaceName);
if (!optionalElanInterface.isPresent()) {
LOG.info("No elan interface data for port {}", portUuid);
return null;
}
ElanInterface elanInterface = optionalElanInterface.get();
return elanInterface.getElanInstanceName();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface in project netvirt by opendaylight.
the class EtreeInterfaceDelete method doExecute.
@Override
protected Object doExecute() {
LOG.debug("Deleting EtreeInterface command etreeName:{}, interfaceName:{}", etreeName, interfaceName);
ElanInterface existingInterface = elanProvider.getElanInterfaceByElanInterfaceName(interfaceName);
if (existingInterface == null || existingInterface.getAugmentation(EtreeInterface.class) == null) {
session.getConsole().println("Etree interface doesn't exist or isn't configured as etree: " + interfaceName);
}
elanProvider.deleteEtreeInterface(interfaceName);
session.getConsole().println("Deleted the Etree interface succesfully");
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface in project netvirt by opendaylight.
the class EtreeInterfaceGet method displayInterfaces.
private void displayInterfaces(ElanInstance elanInstance, List<String> interfaceList) {
if (!interfaceList.isEmpty()) {
for (String elanInterface : interfaceList) {
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(elanInterface);
EtreeInterface etreeInterface = elanProvider.getEtreeInterfaceByElanInterfaceName(elanInterface);
if (interfaceInfo != null) {
session.getConsole().println(String.format(ElanCLIUtils.ETREE_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName() + "/" + elanInstance.getElanTag(), elanInterface + "/" + interfaceInfo.getInterfaceTag(), interfaceInfo.getOpState(), interfaceInfo.getAdminState(), etreeInterface.getEtreeInterfaceType().getName()));
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface in project netvirt by opendaylight.
the class CoeUtils method createElanInterface.
public static void createElanInterface(String elanInterfaceName, String elanInstanceName, WriteTransaction wrtConfigTxn) {
InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface.class, new ElanInterfaceKey(elanInterfaceName)).build();
ElanInterface elanInterface = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName).setName(elanInterfaceName).setKey(new ElanInterfaceKey(elanInterfaceName)).build();
wrtConfigTxn.put(LogicalDatastoreType.CONFIGURATION, id, elanInterface);
LOG.debug("Creating new ELAN Interface {}", elanInterface);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface in project netvirt by opendaylight.
the class CoeUtils method updateElanInterfaceWithStaticMac.
public static void updateElanInterfaceWithStaticMac(String macAddress, IpAddress ipAddress, String elanInterfaceName, WriteTransaction wrtConfigTxn) {
InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface.class, new ElanInterfaceKey(elanInterfaceName)).build();
PhysAddress physAddress = PhysAddress.getDefaultInstance(macAddress);
List<StaticMacEntries> staticMacEntriesList = new ArrayList<>();
StaticMacEntries staticMacEntries = new StaticMacEntriesBuilder().setKey(new StaticMacEntriesKey(physAddress)).setMacAddress(physAddress).setIpPrefix(ipAddress).build();
staticMacEntriesList.add(staticMacEntries);
ElanInterface elanInterface = new ElanInterfaceBuilder().setName(elanInterfaceName).setKey(new ElanInterfaceKey(elanInterfaceName)).setStaticMacEntries(staticMacEntriesList).build();
wrtConfigTxn.merge(LogicalDatastoreType.CONFIGURATION, id, elanInterface);
LOG.debug("Updating ELAN Interface with static mac {}", elanInterface);
}
Aggregations