Search in sources :

Example 26 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project openflowplugin by opendaylight.

the class PortUpdateTranslator method translate.

@Override
public FlowCapableNodeConnector translate(final PortGrouping input, final DeviceInfo deviceInfo, final Object connectionDistinguisher) {
    final FlowCapableNodeConnectorBuilder builder = new FlowCapableNodeConnectorBuilder();
    // OF1.0
    if (deviceInfo.getVersion() == OFConstants.OFP_VERSION_1_0) {
        builder.setAdvertisedFeatures(PortTranslatorUtil.translatePortFeatures(input.getAdvertisedFeaturesV10()));
        builder.setConfiguration(PortTranslatorUtil.translatePortConfig(input.getConfigV10()));
        builder.setCurrentFeature(PortTranslatorUtil.translatePortFeatures(input.getCurrentFeaturesV10()));
        builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeaturesV10()));
        builder.setState(PortTranslatorUtil.translatePortState(input.getStateV10()));
        builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeaturesV10()));
    } else if (deviceInfo.getVersion() == OFConstants.OFP_VERSION_1_3) {
        builder.setAdvertisedFeatures(PortTranslatorUtil.translatePortFeatures(input.getAdvertisedFeatures()));
        builder.setConfiguration(PortTranslatorUtil.translatePortConfig(input.getConfig()));
        builder.setCurrentFeature(PortTranslatorUtil.translatePortFeatures(input.getCurrentFeatures()));
        builder.setPeerFeatures(PortTranslatorUtil.translatePortFeatures(input.getPeerFeatures()));
        builder.setState(PortTranslatorUtil.translatePortState(input.getState()));
        builder.setSupported(PortTranslatorUtil.translatePortFeatures(input.getSupportedFeatures()));
        builder.setQueue(Collections.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue>emptyList());
    }
    if (input instanceof PortStatusMessage) {
        if (((PortStatusMessage) input).getReason() != null) {
            builder.setReason(PortReason.forValue(((PortStatusMessage) input).getReason().getIntValue()));
        } else {
            LOG.debug("PortStatus Message has reason as null");
        }
    }
    builder.setCurrentSpeed(input.getCurrSpeed());
    builder.setHardwareAddress(input.getHwAddr());
    builder.setMaximumSpeed(input.getMaxSpeed());
    builder.setName(input.getName());
    builder.setPortNumber(new PortNumberUni(input.getPortNo()));
    return builder.build();
}
Also used : FlowCapableNodeConnectorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder) PortStatusMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage) PortNumberUni(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni)

Example 27 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project openflowplugin by opendaylight.

the class SalToOfSetFieldCase method process.

@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetFieldCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
    final short version = data.getVersion();
    final SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
    // convert and inject match
    final Optional<Object> conversionMatch = convertorExecutor.convert(source.getSetField(), data);
    MatchInjector.inject(conversionMatch, setFieldBuilder, version);
    return Optional.of(new ActionBuilder().setActionChoice(new SetFieldCaseBuilder().setSetFieldAction(setFieldBuilder.build()).build()).build());
}
Also used : SetFieldCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCaseBuilder) SetFieldActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) SetFieldActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder) Nonnull(javax.annotation.Nonnull)

Example 28 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project netvirt by opendaylight.

the class AclServiceUtils method getAclTag.

/**
 * Gets ACL tag from Acl.
 * @param acl Acl object
 * @return the acl tag
 */
public static Integer getAclTag(Acl acl) {
    Integer aclTag = null;
    AclserviceAugmentation aclserviceAugmentation = acl.augmentation(AclserviceAugmentation.class);
    if (aclserviceAugmentation != null) {
        aclTag = aclserviceAugmentation.getAclTag().intValue();
    }
    return aclTag;
}
Also used : BigInteger(java.math.BigInteger) AclserviceAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.AclserviceAugmentation)

Example 29 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project netvirt by opendaylight.

the class VpnFootprintService method publishRemoveNotification.

@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "https://github.com/spotbugs/spotbugs/issues/811")
private void publishRemoveNotification(final Uint64 dpnId, final String vpnName, final String rd) {
    LOG.debug("publishRemoveNotification: Sending notification for remove dpn {} in vpn {} rd {} event ", dpnId, vpnName, rd);
    RemoveEventData data = new RemoveEventDataBuilder().setVpnName(vpnName).setRd(rd).setDpnId(dpnId).build();
    RemoveDpnEvent event = new RemoveDpnEventBuilder().setRemoveEventData(data).build();
    final ListenableFuture<?> eventFuture = notificationPublishService.offerNotification(event);
    Futures.addCallback(eventFuture, new FutureCallback<Object>() {

        @Override
        public void onFailure(Throwable error) {
            LOG.error("publishRemoveNotification: Error in notifying listeners for remove dpn {} in vpn {} rd {}" + " event ", dpnId, vpnName, rd, error);
        }

        @Override
        public void onSuccess(Object arg) {
            LOG.info("publishRemoveNotification: Successful in notifying listeners for remove dpn {} in vpn {}" + " rd {} event ", dpnId, vpnName, rd);
        }
    }, MoreExecutors.directExecutor());
}
Also used : RemoveDpnEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.RemoveDpnEventBuilder) RemoveEventDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.remove.dpn.event.RemoveEventDataBuilder) RemoveEventData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.remove.dpn.event.RemoveEventData) RemoveDpnEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.RemoveDpnEvent) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 30 with Object

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object in project netvirt by opendaylight.

the class VpnManagerImpl method addSubnetAssociationOperationToTx.

private void addSubnetAssociationOperationToTx(String rt, RouteTarget.RtType rtType, String cidr, String vpnName, TypedReadWriteTransaction<Operational> tx, boolean isAssociationRemoved) throws InterruptedException, ExecutionException {
    if (isAssociationRemoved) {
        // Remove RT-Subnet-Vpn Association
        Optional<AssociatedSubnet> associatedSubnet = tx.read(VpnUtil.getAssociatedSubnetIdentifier(rt, rtType, cidr)).get();
        boolean deleteParent = false;
        if (associatedSubnet.isPresent()) {
            List<AssociatedVpn> associatedVpns = new ArrayList<>(associatedSubnet.get().nonnullAssociatedVpn().values());
            if (associatedVpns == null || associatedVpns.isEmpty()) {
                deleteParent = true;
            } else {
                for (Iterator<AssociatedVpn> iterator = associatedVpns.iterator(); iterator.hasNext(); ) {
                    AssociatedVpn associatedVpn = iterator.next();
                    if (Objects.equals(associatedVpn.getName(), vpnName)) {
                        iterator.remove();
                        break;
                    }
                }
                if (associatedVpns.isEmpty()) {
                    deleteParent = true;
                }
            }
        }
        if (deleteParent) {
            deleteParentForSubnetToVpnAssociation(rt, rtType, cidr, tx);
        } else {
            // Some other VPNs are also part of this rtVal, rtType and subnetCidr combination.
            // Delete only this AssociatedVpn Object
            tx.delete(VpnUtil.getAssociatedSubnetAndVpnIdentifier(rt, rtType, cidr, vpnName));
            LOG.debug("addSubnetAssocOperationToTx: Removed vpn {} from association rt {} rtType {} cidr {}", vpnName, rt, rtType, cidr);
        }
    } else {
        // Add RT-Subnet-Vpn Association
        tx.mergeParentStructurePut(VpnUtil.getAssociatedSubnetAndVpnIdentifier(rt, rtType, cidr, vpnName), VpnUtil.buildAssociatedSubnetAndVpn(vpnName));
    }
}
Also used : ArrayList(java.util.ArrayList) AssociatedSubnet(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.AssociatedSubnet) AssociatedVpn(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.associated.subnet.AssociatedVpn)

Aggregations

ArrayList (java.util.ArrayList)94 ByteBuf (io.netty.buffer.ByteBuf)82 Test (org.junit.Test)62 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)34 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object)33 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)33 ExecutionException (java.util.concurrent.ExecutionException)30 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)29 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)25 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes)25 List (java.util.List)21 HashMap (java.util.HashMap)19 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)18 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)17 Nullable (org.eclipse.jdt.annotation.Nullable)16 UnknownObject (org.opendaylight.protocol.pcep.spi.UnknownObject)16 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)15 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)15 FutureCallback (com.google.common.util.concurrent.FutureCallback)14 BigInteger (java.math.BigInteger)14