Search in sources :

Example 1 with L2gateways

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.L2gateways in project netvirt by opendaylight.

the class L2GwValidateCli method readNodes.

private void readNodes() throws ReadFailedException {
    try (ReadOnlyTransaction tx = dataBroker.newReadOnlyTransaction()) {
        InstanceIdentifier<Topology> topoId = HwvtepSouthboundUtils.createHwvtepTopologyInstanceIdentifier();
        Optional<Topology> operationalTopoOptional = tx.read(LogicalDatastoreType.OPERATIONAL, topoId).checkedGet();
        Optional<Topology> configTopoOptional = tx.read(LogicalDatastoreType.CONFIGURATION, topoId).checkedGet();
        if (operationalTopoOptional.isPresent()) {
            for (Node node : operationalTopoOptional.get().getNode()) {
                InstanceIdentifier<Node> nodeIid = topoId.child(Node.class, node.getKey());
                operationalNodes.put(nodeIid, node);
            }
        }
        if (configTopoOptional.isPresent()) {
            for (Node node : configTopoOptional.get().getNode()) {
                InstanceIdentifier<Node> nodeIid = topoId.child(Node.class, node.getKey());
                configNodes.put(nodeIid, node);
            }
        }
        fillNodesData(operationalNodes, operationalNodesData);
        fillNodesData(configNodes, configNodesData);
        Optional<ElanInstances> elanInstancesOptional = tx.read(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(ElanInstances.class).build()).checkedGet();
        if (elanInstancesOptional.isPresent() && elanInstancesOptional.get().getElanInstance() != null) {
            for (ElanInstance elanInstance : elanInstancesOptional.get().getElanInstance()) {
                elanInstanceMap.put(elanInstance.getElanInstanceName(), elanInstance);
            }
        }
        l2gatewayConnections = L2GatewayConnectionUtils.getAllL2gatewayConnections(dataBroker);
        l2gateways = L2GatewayConnectionUtils.getL2gatewayList(dataBroker);
        for (L2gateway l2gateway : l2gateways) {
            uuidToL2Gateway.put(l2gateway.getUuid(), l2gateway);
        }
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) L2gateway(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.l2gateways.L2gateway) ElanInstances(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances)

Aggregations

ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)1 ElanInstances (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances)1 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)1 L2gateway (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateways.attributes.l2gateways.L2gateway)1 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)1 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)1