Search in sources :

Example 1 with InterfacesState

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState in project lispflowmapping by opendaylight.

the class VppNodeReader method readFirstAvailableIpOfVppNode.

private ListenableFuture<Optional<Ipv4Address>> readFirstAvailableIpOfVppNode(final KeyedInstanceIdentifier<Node, NodeKey> instanceIdentifierToVppNode) {
    final SettableFuture<Optional<Ipv4Address>> resultFuture = SettableFuture.create();
    final DataBroker vppDataBroker = LispNeutronUtil.resolveDataBrokerForMountPoint(instanceIdentifierToVppNode, mountService);
    if (vppDataBroker != null) {
        final Optional<InterfacesState> interfacesOnVppNodeOptional = VppNetconfTrasaction.read(vppDataBroker, LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(InterfacesState.class));
        if (interfacesOnVppNodeOptional.isPresent()) {
            for (Interface intf : interfacesOnVppNodeOptional.get().getInterface()) {
                if (intf.getType().equals(Loopback.class)) {
                    continue;
                }
                final Optional<Ipv4Address> ipv4AddressOptional = readIpAddressFromInterface(intf, instanceIdentifierToVppNode);
                if (ipv4AddressOptional.isPresent()) {
                    resultFuture.set(ipv4AddressOptional);
                    break;
                }
            }
        }
        resultFuture.set(Optional.absent());
    } else {
        LOG.debug("Data broker for vpp {} is missing.", instanceIdentifierToVppNode);
    }
    return resultFuture;
}
Also used : Optional(com.google.common.base.Optional) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) InterfacesState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Example 2 with InterfacesState

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState in project genius by opendaylight.

the class TepDeleteDatastore method doExecute.

@Override
protected Object doExecute() {
    final DataBroker dataBroker = itmProvider.getDataBroker();
    InstanceIdentifier<TransportZones> itmConfigPath = InstanceIdentifier.builder(TransportZones.class).build();
    InstanceIdentifier<Interfaces> interfacesConfigPath = InstanceIdentifier.builder(Interfaces.class).build();
    final InstanceIdentifier<InterfacesState> ifStateOpPath = InstanceIdentifier.builder(InterfacesState.class).build();
    InstanceIdentifier<Nodes> frmConfigPath = InstanceIdentifier.builder(Nodes.class).build();
    List<InstanceIdentifier<T>> allConfigPaths = new ArrayList<>();
    allConfigPaths.add((InstanceIdentifier<T>) itmConfigPath);
    allConfigPaths.add((InstanceIdentifier<T>) interfacesConfigPath);
    allConfigPaths.add((InstanceIdentifier<T>) frmConfigPath);
    // allConfigPaths.add((InstanceIdentifier<T>) tunnelsConfigPath);
    ItmUtils.asyncBulkRemove(dataBroker, LogicalDatastoreType.CONFIGURATION, allConfigPaths, ItmUtils.DEFAULT_CALLBACK);
    List<InstanceIdentifier<T>> allOperationalPaths = new ArrayList<>();
    // allOperationalPaths.add((InstanceIdentifier<T>) tnStateOpPath);
    allOperationalPaths.add((InstanceIdentifier<T>) ifStateOpPath);
    ItmUtils.asyncBulkRemove(dataBroker, LogicalDatastoreType.OPERATIONAL, allOperationalPaths, ItmUtils.DEFAULT_CALLBACK);
    return null;
}
Also used : ArrayList(java.util.ArrayList) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Interfaces(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) InterfacesState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState)

Aggregations

DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)2 InterfacesState (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState)2 Optional (com.google.common.base.Optional)1 ArrayList (java.util.ArrayList)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Interfaces (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces)1 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)1 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)1 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1