Search in sources :

Example 26 with ElanInterface

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();
}
Also used : ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)

Example 27 with ElanInterface

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;
}
Also used : ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)

Example 28 with ElanInterface

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()));
            }
        }
    }
}
Also used : InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface)

Example 29 with 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 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);
}
Also used : ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)

Example 30 with 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);
}
Also used : StaticMacEntriesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ArrayList(java.util.ArrayList) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) StaticMacEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries) StaticMacEntriesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesKey) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Aggregations

ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)21 ArrayList (java.util.ArrayList)11 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)11 StaticMacEntries (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries)10 ElanInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder)9 ElanInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)8 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)7 BigInteger (java.math.BigInteger)6 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)6 Elan (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan)5 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)4 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)4 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)4 ElanDpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)4 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)3 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)3 ElanException (org.opendaylight.netvirt.elan.ElanException)3 ElanInterfaceMac (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac)3 StaticMacEntriesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder)3 Optional (com.google.common.base.Optional)2