use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class AbstractDirectStatisticsServiceTest method init.
@Before
public void init() throws Exception {
nodeConnectorId = InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(DATAPATH_ID, PORT_NO, OpenflowVersion.get(OF_VERSION));
nodeInstanceIdentifier = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(NODE_ID)));
convertorManager = ConvertorManagerFactory.createDefaultManager();
when(deviceContext.getDeviceFlowRegistry()).thenReturn(deviceFlowRegistry);
when(deviceContext.getDeviceGroupRegistry()).thenReturn(deviceGroupRegistry);
when(deviceContext.getDeviceMeterRegistry()).thenReturn(deviceMeterRegistry);
when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
when(deviceContext.getMultiMsgCollector(any())).thenReturn(multiMsgCollector);
when(deviceContext.oook()).thenReturn(translatorLibrary);
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
when(deviceInfo.getNodeId()).thenReturn(new NodeId(NODE_ID));
when(deviceInfo.getVersion()).thenReturn(OF_VERSION);
when(deviceInfo.getDatapathId()).thenReturn(DATAPATH_ID);
when(getFeaturesOutput.getVersion()).thenReturn(OF_VERSION);
when(getFeaturesOutput.getDatapathId()).thenReturn(DATAPATH_ID);
when(connectionContext.getFeatures()).thenReturn(features);
when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
when(features.getVersion()).thenReturn(OF_VERSION);
when(features.getDatapathId()).thenReturn(DATAPATH_ID);
multipartWriterProvider = MultipartWriterProviderFactory.createDefaultProvider(deviceContext);
setUp();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class RpcManagerImplTest method setUp.
@Before
public void setUp() {
final NodeKey nodeKey = new NodeKey(nodeId);
rpcManager = new RpcManagerImpl(new OpenflowProviderConfigBuilder().setRpcRequestsQuota(new NonZeroUint16Type(QUOTA_VALUE)).setIsStatisticsRpcEnabled(false).build(), rpcProviderRegistry, extensionConverterProvider, convertorExecutor, notificationPublishService);
FeaturesReply features = new GetFeaturesOutputBuilder().setVersion(OFConstants.OFP_VERSION_1_3).build();
Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeKey.getId());
Mockito.when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
Mockito.when(connectionContext.getFeatures()).thenReturn(features);
Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState);
Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
Mockito.when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
Mockito.when(rpcProviderRegistry.addRoutedRpcImplementation(Matchers.any(), Matchers.any(RpcService.class))).thenReturn(routedRpcRegistration);
Mockito.when(contexts.remove(deviceInfo)).thenReturn(removedContexts);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class SyncReactorImpl method syncup.
@Override
public ListenableFuture<Boolean> syncup(final InstanceIdentifier<FlowCapableNode> nodeIdent, final SyncupEntry syncupEntry) {
final NodeId nodeId = PathUtil.digNodeId(nodeIdent);
FlowCapableNode configTree = syncupEntry.getAfter();
FlowCapableNode operationalTree = syncupEntry.getBefore();
final SyncCrudCounters counters = new SyncCrudCounters();
/**
* instructions:
* - extract diff changes and prepare change steps in safe order
* - optimization: decide if updates needed
* - execute chosen implementation (e.g. conventional API, bulk API, flat bulk API)
* - recommended order follows:
* reconciliation strategy - phase 1: - add/update missing objects in following order:
* - table features - groups (reordered) - meters - flows
* reconciliation strategy - phase 2: - remove redundant objects in following order:
* - flows - meters - groups (reordered)
*/
final List<ItemSyncBox<Group>> groupsToAddOrUpdate = extractGroupsToAddOrUpdate(nodeId, configTree, operationalTree);
final ItemSyncBox<Meter> metersToAddOrUpdate = extractMetersToAddOrUpdate(nodeId, configTree, operationalTree);
final Map<TableKey, ItemSyncBox<Flow>> flowsToAddOrUpdate = extractFlowsToAddOrUpdate(nodeId, configTree, operationalTree);
final Map<TableKey, ItemSyncBox<Flow>> flowsToRemove = extractFlowsToRemove(nodeId, configTree, operationalTree);
final ItemSyncBox<Meter> metersToRemove = extractMetersToRemove(nodeId, configTree, operationalTree);
final List<ItemSyncBox<Group>> groupsToRemove = extractGroupsToRemove(nodeId, configTree, operationalTree);
final SynchronizationDiffInput input = new SynchronizationDiffInput(nodeIdent, groupsToAddOrUpdate, metersToAddOrUpdate, flowsToAddOrUpdate, flowsToRemove, metersToRemove, groupsToRemove);
final ListenableFuture<RpcResult<Void>> bootstrapResultFuture = RpcResultBuilder.<Void>success().buildFuture();
final ListenableFuture<RpcResult<Void>> resultVehicle = syncPlanPushStrategy.executeSyncStrategy(bootstrapResultFuture, input, counters);
return Futures.transform(resultVehicle, input1 -> {
if (input1 == null) {
return false;
}
if (LOG.isDebugEnabled()) {
final CrudCounts flowCrudCounts = counters.getFlowCrudCounts();
final CrudCounts meterCrudCounts = counters.getMeterCrudCounts();
final CrudCounts groupCrudCounts = counters.getGroupCrudCounts();
LOG.debug("Syncup outcome[{}] (added/updated/removed): flow={}/{}/{}, group={}/{}/{}, " + "meter={}/{}/{}, errors={}", nodeId.getValue(), flowCrudCounts.getAdded(), flowCrudCounts.getUpdated(), flowCrudCounts.getRemoved(), groupCrudCounts.getAdded(), groupCrudCounts.getUpdated(), groupCrudCounts.getRemoved(), meterCrudCounts.getAdded(), meterCrudCounts.getUpdated(), meterCrudCounts.getRemoved(), Arrays.toString(input1.getErrors().toArray()));
}
return input1.isSuccessful();
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class PortMessageSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(MESSAGE, out);
// Header
assertEquals(out.readByte(), VERSION);
assertEquals(out.readByte(), serializer.getMessageType());
assertEquals(out.readShort(), LENGTH);
assertEquals(out.readInt(), XID.intValue());
// Body
assertEquals(out.readInt(), PORT_NUMBER_VAL.intValue());
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_01);
byte[] address = new byte[6];
out.readBytes(address);
assertEquals(new MacAddress(ByteBufUtils.macAddressToString(address)).getValue(), new MacAddress(MAC_ADDRESS).getValue());
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_02);
// Port config
final int config = ByteBufUtils.fillBitMaskFromMap(ImmutableMap.<Integer, Boolean>builder().put(0, IS_PORTDOWN).put(2, IS_NORECV).put(5, IS_NOFWD).put(6, IS_NOPACKETIN).build());
final int mask = ByteBufUtils.fillBitMaskFromMap(ImmutableMap.<Integer, Boolean>builder().put(0, true).put(2, true).put(5, true).put(6, true).build());
assertEquals(out.readInt(), config);
assertEquals(out.readInt(), mask);
// Port features
assertEquals(out.readInt(), ByteBufUtils.fillBitMask(0, IS_10MBHD, IS_10MBFD, IS_100MBHD, IS_100MBFD, IS_1GBHD, IS_1GBFD, IS_10GBFD, IS_40GBFD, IS_100GBFD, IS_1TBFD, IS_OTHER, IS_COPPER, IS_FIBER, IS_AUTOENG, IS_PAUSE, IS_PAUSE_ASYM));
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_03);
assertEquals(out.readableBytes(), 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.extensions.rev160617.service.provider.features.attributes.Features in project openflowplugin by opendaylight.
the class AbstractTableMultipartService method storeStatistics.
/**
* Stores table features to operational datastore.
*/
protected void storeStatistics(List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> result) {
multipartWriterProvider.lookup(MultipartType.OFPMPTABLEFEATURES).ifPresent(writer -> {
writer.write(new TableUpdatedBuilder().setTableFeatures(result).build(), false);
getTxFacade().submitTransaction();
});
}
Aggregations