use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class PortStatsServiceTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
Xid xid = new Xid(42L);
GetNodeConnectorStatisticsInputBuilder input = new GetNodeConnectorStatisticsInputBuilder().setNodeConnectorId(new NodeConnectorId("junitProto:11:12")).setNode(createNodeRef("junitProto:11"));
final OfHeader request = portStatsService.buildRequest(xid, input.build());
Assert.assertTrue(request instanceof MultipartRequestInput);
final MultipartRequestInput mpRequest = (MultipartRequestInput) request;
Assert.assertTrue(mpRequest.getMultipartRequestBody() instanceof MultipartRequestPortStatsCase);
final MultipartRequestPortStatsCase mpRequestBody = (MultipartRequestPortStatsCase) mpRequest.getMultipartRequestBody();
Assert.assertEquals(12L, mpRequestBody.getMultipartRequestPortStats().getPortNo().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class NodeConnectorDirectStatisticsServiceTest method testBuildRequestBody.
@Override
public void testBuildRequestBody() throws Exception {
final GetNodeConnectorStatisticsInput input = mock(GetNodeConnectorStatisticsInput.class);
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getNodeConnectorId()).thenReturn(nodeConnectorId);
final MultipartRequestPortStatsCase body = (MultipartRequestPortStatsCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
final MultipartRequestPortStats nodeConnector = body.getMultipartRequestPortStats();
assertEquals(PORT_NO, nodeConnector.getPortNo());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class NodeConnectorDirectStatisticsServiceTest method testStoreStatistics.
@Override
public void testStoreStatistics() throws Exception {
final NodeConnectorStatisticsAndPortNumberMap stat = mock(NodeConnectorStatisticsAndPortNumberMap.class);
when(stat.getNodeConnectorId()).thenReturn(nodeConnectorId);
final List<NodeConnectorStatisticsAndPortNumberMap> stats = Collections.singletonList(stat);
final GetNodeConnectorStatisticsOutput output = mock(GetNodeConnectorStatisticsOutput.class);
when(output.getNodeConnectorStatisticsAndPortNumberMap()).thenReturn(stats);
multipartWriterProvider.lookup(MultipartType.OFPMPPORTSTATS).get().write(output, true);
verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class PacketProcessingServiceImplTest method setup.
@Override
protected void setup() {
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
packetProcessingService = new PacketProcessingServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager);
pathToNodeconnector = KeyedInstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId("ofp-ut:123"))).child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("ofp-ut:123:1")));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId in project openflowplugin by opendaylight.
the class MatchConvertor method inPhyPortMatch.
private static void inPhyPortMatch(final List<MatchEntry> matchEntryList, NodeConnectorId inPhyPort) {
if (inPhyPort == null) {
return;
}
// TODO: currently this matchconverter is mapped to OF1.3 in MatchInjector. Will need to revisit during 1.4+
final long portNumber = InventoryDataServiceUtil.portNumberfromNodeConnectorId(OpenflowVersion.OF13, inPhyPort);
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(InPhyPort.class);
InPhyPortCaseBuilder caseBuilder = new InPhyPortCaseBuilder();
InPhyPortBuilder portBuilder = new InPhyPortBuilder();
portBuilder.setPortNumber(new PortNumber(portNumber));
caseBuilder.setInPhyPort(portBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
matchEntryList.add(matchEntryBuilder.build());
}
Aggregations