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();
}
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());
}
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;
}
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());
}
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));
}
}
Aggregations