Search in sources :

Example 66 with Network

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.

the class QosAlertManager method removeFromQosAlertCache.

public void removeFromQosAlertCache(Network network) {
    LOG.trace("Removing network {} from cache", network.getUuid());
    List<Uuid> subnetIds = qosNeutronUtils.getSubnetIdsFromNetworkId(network.getUuid());
    for (Uuid subnetId : subnetIds) {
        List<Uuid> portIds = qosNeutronUtils.getPortIdsFromSubnetId(subnetId);
        for (Uuid portId : portIds) {
            Port port = neutronVpnManager.getNeutronPort(portId);
            if (port != null && !qosNeutronUtils.portHasQosPolicy(port)) {
                LOG.trace("Removing network {} port {} from cache", network.getUuid(), port.getUuid());
                removeFromQosAlertCache(port);
            }
        }
    }
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)

Example 67 with Network

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.

the class QosNeutronNetworkChangeListener method add.

@Override
protected void add(InstanceIdentifier<Network> instanceIdentifier, Network network) {
    QosNetworkExtension networkQos = network.getAugmentation(QosNetworkExtension.class);
    if (networkQos != null) {
        qosNeutronUtils.addToQosNetworksCache(networkQos.getQosPolicyId(), network);
        qosNeutronUtils.handleNeutronNetworkQosUpdate(network, networkQos.getQosPolicyId());
        if (qosNeutronUtils.hasBandwidthLimitRule(network)) {
            qosAlertManager.addToQosAlertCache(network);
        }
    }
}
Also used : QosNetworkExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension)

Example 68 with Network

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.

the class QosNeutronNetworkChangeListener method update.

@Override
protected void update(InstanceIdentifier<Network> instanceIdentifier, Network original, Network update) {
    QosNetworkExtension updateQos = update.getAugmentation(QosNetworkExtension.class);
    QosNetworkExtension originalQos = original.getAugmentation(QosNetworkExtension.class);
    if (originalQos == null && updateQos != null) {
        // qosservice policy add
        qosNeutronUtils.addToQosNetworksCache(updateQos.getQosPolicyId(), update);
        qosNeutronUtils.handleNeutronNetworkQosUpdate(update, updateQos.getQosPolicyId());
        if (qosNeutronUtils.hasBandwidthLimitRule(update)) {
            qosAlertManager.addToQosAlertCache(update);
        }
    } else if (originalQos != null && updateQos != null && !originalQos.getQosPolicyId().equals(updateQos.getQosPolicyId())) {
        // qosservice policy update
        qosNeutronUtils.removeFromQosNetworksCache(originalQos.getQosPolicyId(), original);
        qosNeutronUtils.addToQosNetworksCache(updateQos.getQosPolicyId(), update);
        qosNeutronUtils.handleNeutronNetworkQosUpdate(update, updateQos.getQosPolicyId());
        if (qosNeutronUtils.hasBandwidthLimitRule(original) && !qosNeutronUtils.hasBandwidthLimitRule(update)) {
            qosAlertManager.removeFromQosAlertCache(original);
        } else if (!qosNeutronUtils.hasBandwidthLimitRule(original) && qosNeutronUtils.hasBandwidthLimitRule(update)) {
            qosAlertManager.addToQosAlertCache(update);
        }
    } else if (originalQos != null && updateQos == null) {
        // qosservice policy delete
        if (qosNeutronUtils.hasBandwidthLimitRule(original)) {
            qosAlertManager.removeFromQosAlertCache(original);
        }
        qosNeutronUtils.handleNeutronNetworkQosRemove(original, originalQos.getQosPolicyId());
        qosNeutronUtils.removeFromQosNetworksCache(originalQos.getQosPolicyId(), original);
    }
}
Also used : QosNetworkExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension)

Example 69 with Network

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.

the class QosNeutronUtils method hasBandwidthLimitRule.

public boolean hasBandwidthLimitRule(Port port) {
    Uuid qosUuid = null;
    boolean bwLimitRule = false;
    LOG.trace("checking bandwidth limit rule for  port: {}", port.getUuid());
    if (port.getAugmentation(QosPortExtension.class) != null) {
        qosUuid = port.getAugmentation(QosPortExtension.class).getQosPolicyId();
    } else {
        Network network = neutronVpnManager.getNeutronNetwork(port.getNetworkId());
        if (network.getAugmentation(QosNetworkExtension.class) != null) {
            qosUuid = network.getAugmentation(QosNetworkExtension.class).getQosPolicyId();
        }
    }
    if (qosUuid != null) {
        QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
        if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
            bwLimitRule = true;
        }
    }
    LOG.trace("Bandwidth limit rule for  port: {} return value {}", port.getUuid(), bwLimitRule);
    return bwLimitRule;
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) QosNetworkExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) QosPortExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension) QosPolicy(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)

Example 70 with Network

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.

the class QosNeutronUtils method handleNeutronNetworkQosDscpRuleRemove.

public void handleNeutronNetworkQosDscpRuleRemove(Network network) {
    LOG.trace("Handling Qos Dscp Rule Remove, net: {}", network.getUuid());
    List<Uuid> subnetIds = getSubnetIdsFromNetworkId(network.getUuid());
    for (Uuid subnetId : subnetIds) {
        List<Uuid> portIds = getPortIdsFromSubnetId(subnetId);
        for (Uuid portId : portIds) {
            Port port = neutronVpnManager.getNeutronPort(portId);
            if (port != null && (port.getAugmentation(QosPortExtension.class) == null || port.getAugmentation(QosPortExtension.class).getQosPolicyId() == null)) {
                jobCoordinator.enqueueJob("QosPort-" + portId.getValue(), () -> {
                    WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
                    List<ListenableFuture<Void>> futures = new ArrayList<>();
                    unsetPortDscpMark(port);
                    futures.add(wrtConfigTxn.submit());
                    return futures;
                });
            }
        }
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) QosPortExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension)

Aggregations

Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)93 ArrayList (java.util.ArrayList)46 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)33 BigInteger (java.math.BigInteger)31 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)31 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)26 ProviderTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ProviderTypes)19 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)19 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)19 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)17 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)15 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)12 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)11 ExecutionException (java.util.concurrent.ExecutionException)10 ExternalNetworks (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ExternalNetworks)10 Networks (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.networks.Networks)10 QosPolicy (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)10 Routers (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers)9 HashSet (java.util.HashSet)8 Nonnull (javax.annotation.Nonnull)8