External api proposal
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / sal / ModelDrivenSwitchImplTest.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.openflow.md.core.sal;
10
11 import java.math.BigInteger;
12 import java.util.ArrayList;
13 import java.util.Collections;
14 import java.util.List;
15 import java.util.Set;
16 import java.util.concurrent.ExecutionException;
17 import java.util.concurrent.Executors;
18
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.junit.runner.RunWith;
22 import org.mockito.Matchers;
23 import org.mockito.Mock;
24 import org.mockito.Mockito;
25 import org.mockito.runners.MockitoJUnitRunner;
26 import org.opendaylight.controller.sal.common.util.Rpcs;
27 import org.opendaylight.openflowplugin.api.OFConstants;
28 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
29 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
30 import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
31 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
32 import org.opendaylight.openflowplugin.api.statistics.MessageSpy;
33 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
34 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutputBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutputBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.PortBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortKey;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutputBuilder;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInputBuilder;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutputBuilder;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInputBuilder;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutputBuilder;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInputBuilder;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutputBuilder;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInputBuilder;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutputBuilder;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutputBuilder;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInputBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutputBuilder;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInputBuilder;
93 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutputBuilder;
94 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInputBuilder;
95 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutputBuilder;
96 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInputBuilder;
97 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutputBuilder;
98 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
99 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
100 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
101 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
102 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
103 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
104 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
105 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;
106 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;
107 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
108 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
109 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInputBuilder;
110 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
111 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutputBuilder;
112 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPortBuilder;
113 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInputBuilder;
114 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutputBuilder;
115 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInputBuilder;
116 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutputBuilder;
117 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInputBuilder;
118 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutputBuilder;
119 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInputBuilder;
120 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutputBuilder;
121 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInputBuilder;
122 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutputBuilder;
123 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder;
124 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
125 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTable;
126 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder;
127 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig;
128 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder;
129 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
130 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
131 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey;
132 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
133 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties;
134 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
135 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey;
136 import org.opendaylight.yangtools.yang.binding.DataContainer;
137 import org.opendaylight.yangtools.yang.common.RpcError;
138 import org.opendaylight.yangtools.yang.common.RpcResult;
139
140 import com.google.common.util.concurrent.Futures;
141 import com.google.common.util.concurrent.MoreExecutors;
142
143 /**
144  * simple NPE smoke test
145  */
146 @RunWith(MockitoJUnitRunner.class)
147 public class ModelDrivenSwitchImplTest {
148
149     private ModelDrivenSwitchImpl mdSwitchOF10;
150     private ModelDrivenSwitchImpl mdSwitchOF13;
151
152     @Mock
153     private SessionContext context;
154     @Mock
155     private ConnectionConductor conductor;
156     @Mock
157     private IMessageDispatchService messageDispatchService;
158     @Mock
159     private GetFeaturesOutput features;
160     @Mock
161     private MessageSpy<DataContainer> messageSpy;
162
163     /**
164      * @throws java.lang.Exception
165      */
166     @Before
167     public void setUp() throws Exception {
168         Mockito.when(context.getPrimaryConductor()).thenReturn(conductor);
169         Mockito.when(context.getMessageDispatchService()).thenReturn(messageDispatchService);
170         Mockito.when(conductor.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_0)
171                 .thenReturn(OFConstants.OFP_VERSION_1_3);
172         Mockito.when(context.getFeatures()).thenReturn(features);
173         Mockito.when(features.getDatapathId()).thenReturn(BigInteger.valueOf(1));
174         
175         OFSessionUtil.getSessionManager().setRpcPool(MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10)));
176         OFSessionUtil.getSessionManager().setMessageSpy(messageSpy);
177         OpenflowPortsUtil.init();
178
179         mdSwitchOF10 = new ModelDrivenSwitchImpl(null, null, context);
180         mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context);
181     }
182
183     /**
184      * Test method for
185      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#addFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput)}
186      * .
187      * @throws ExecutionException 
188      * @throws InterruptedException 
189      */
190     @Test
191     public void testAddFlow() throws InterruptedException, ExecutionException {
192         UpdateFlowOutputBuilder updateFlowOutput = new UpdateFlowOutputBuilder();
193         updateFlowOutput.setTransactionId(new TransactionId(new BigInteger("42")));
194         Set<RpcError> errorSet = Collections.emptySet();
195         RpcResult<UpdateFlowOutput> result = Rpcs.getRpcResult(true, updateFlowOutput.build(), errorSet);
196         Mockito.when(
197                 messageDispatchService.flowMod(Matchers.any(FlowModInput.class),
198                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
199
200         AddFlowInputBuilder input = new AddFlowInputBuilder();
201         input.setMatch(createMatch());
202
203         Mockito.when(features.getVersion()).thenReturn((short)1);
204         mdSwitchOF10.addFlow(input.build()).get();
205         Mockito.when(features.getVersion()).thenReturn((short)4);
206         mdSwitchOF13.addFlow(input.build()).get();
207         Mockito.verify(messageDispatchService, Mockito.times(2)).flowMod(
208                 Matchers.any(FlowModInput.class),
209                 Matchers.any(SwitchConnectionDistinguisher.class));
210     }
211
212     /**
213      * Test method for
214      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#removeFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput)}
215      * .
216      * @throws ExecutionException 
217      * @throws InterruptedException 
218      */
219     @Test
220     public void testRemoveFlow() throws InterruptedException, ExecutionException {
221         UpdateFlowOutputBuilder updateFlowOutput = new UpdateFlowOutputBuilder();
222         updateFlowOutput.setTransactionId(new TransactionId(new BigInteger("42")));
223         Set<RpcError> errorSet = Collections.emptySet();
224         RpcResult<UpdateFlowOutput> result = Rpcs.getRpcResult(true, updateFlowOutput.build(), errorSet);
225         Mockito.when(
226                 messageDispatchService.flowMod(Matchers.any(FlowModInput.class),
227                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
228
229         RemoveFlowInputBuilder input = new RemoveFlowInputBuilder();
230         input.setMatch(createMatch());
231
232         Mockito.when(features.getVersion()).thenReturn((short)1);
233         mdSwitchOF10.removeFlow(input.build()).get();
234         Mockito.when(features.getVersion()).thenReturn((short)4);
235         mdSwitchOF13.removeFlow(input.build()).get();
236         Mockito.verify(messageDispatchService, Mockito.times(2)).flowMod(
237                 Matchers.any(FlowModInput.class),
238                 Matchers.any(SwitchConnectionDistinguisher.class));
239         
240     }
241
242     /**
243      * Test method for
244      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#updateFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput)}
245      * .
246      * @throws ExecutionException 
247      * @throws InterruptedException 
248      */
249     @Test
250     public void testUpdateFlow() throws InterruptedException, ExecutionException {
251         UpdateFlowOutputBuilder updateFlowOutput = new UpdateFlowOutputBuilder();
252         updateFlowOutput.setTransactionId(new TransactionId(new BigInteger("42")));
253         Set<RpcError> errorSet = Collections.emptySet();
254         RpcResult<UpdateFlowOutput> result = Rpcs.getRpcResult(true, updateFlowOutput.build(), errorSet);
255         Mockito.when(
256                 messageDispatchService.flowMod(Matchers.any(FlowModInput.class),
257                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
258
259         UpdateFlowInputBuilder input = new UpdateFlowInputBuilder();
260         UpdatedFlowBuilder updatedFlow = new UpdatedFlowBuilder();
261         updatedFlow.setBarrier(false);
262         updatedFlow.setMatch(createMatch());
263         updatedFlow.setPriority(65);
264         updatedFlow.setFlags(new FlowModFlags(true, false, true, false, true));
265         input.setUpdatedFlow(updatedFlow.build());
266         OriginalFlowBuilder originalFlowBuilder = new OriginalFlowBuilder();
267         originalFlowBuilder.setMatch(createMatch());
268         originalFlowBuilder.setPriority(65);
269         originalFlowBuilder.setFlags(new FlowModFlags(true, false, true, false, true));
270         input.setOriginalFlow(originalFlowBuilder.build());
271         
272         Mockito.when(features.getVersion()).thenReturn((short)1);
273         mdSwitchOF10.updateFlow(input.build()).get();
274         Mockito.when(features.getVersion()).thenReturn((short)4);
275         mdSwitchOF13.updateFlow(input.build()).get();
276         Mockito.verify(messageDispatchService, Mockito.times(2)).flowMod(
277                 Matchers.any(FlowModInput.class),
278                 Matchers.any(SwitchConnectionDistinguisher.class));
279     }
280     
281     /**
282      * Test method for
283      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
284      * addGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.
285      * AddGroupInput)}
286      * .
287      * @throws ExecutionException 
288      * @throws InterruptedException 
289      */
290     @Test
291     public void testAddGroup() throws InterruptedException, ExecutionException {
292         UpdateGroupOutputBuilder updateGroupOutput = new UpdateGroupOutputBuilder();
293         updateGroupOutput.setTransactionId(new TransactionId(new BigInteger("42")));
294         Set<RpcError> errorSet = Collections.emptySet();
295         RpcResult<UpdateGroupOutput> result = Rpcs.getRpcResult(true, updateGroupOutput.build(), errorSet);
296         Mockito.when(
297                 messageDispatchService.groupMod(Matchers.any(GroupModInput.class),
298                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
299
300         AddGroupInputBuilder input = new AddGroupInputBuilder();
301         input.setGroupType(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes.GroupFf);
302         input.setGroupId(new GroupId(789L));
303
304         mdSwitchOF10.addGroup(input.build()).get();
305         mdSwitchOF13.addGroup(input.build()).get();
306         Mockito.verify(messageDispatchService, Mockito.times(2)).groupMod(
307                 Matchers.any(GroupModInput.class),
308                 Matchers.any(SwitchConnectionDistinguisher.class));
309     }
310     
311     /**
312      * Test method for
313      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
314      * updateGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.
315      * UpdateGroupInput)}
316      * .
317      * @throws ExecutionException 
318      * @throws InterruptedException 
319      */
320     @Test
321     public void testUpdateGroup() throws InterruptedException, ExecutionException {
322         UpdateGroupOutputBuilder updateGroupOutput = new UpdateGroupOutputBuilder();
323         updateGroupOutput.setTransactionId(new TransactionId(new BigInteger("42")));
324         Set<RpcError> errorSet = Collections.emptySet();
325         RpcResult<UpdateGroupOutput> result = Rpcs.getRpcResult(true, updateGroupOutput.build(), errorSet);
326         Mockito.when(
327                 messageDispatchService.groupMod(Matchers.any(GroupModInput.class),
328                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
329
330         UpdateGroupInputBuilder input = new UpdateGroupInputBuilder();
331         UpdatedGroupBuilder updatedGroupBuilder = new UpdatedGroupBuilder();
332         updatedGroupBuilder.setGroupId(new GroupId(789L));
333         updatedGroupBuilder.setGroupType(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes.GroupFf);
334         input.setUpdatedGroup(updatedGroupBuilder.build());
335
336         mdSwitchOF10.updateGroup(input.build()).get();
337         mdSwitchOF13.updateGroup(input.build()).get();
338         Mockito.verify(messageDispatchService, Mockito.times(2)).groupMod(
339                 Matchers.any(GroupModInput.class),
340                 Matchers.any(SwitchConnectionDistinguisher.class));
341     }
342     
343     /**
344      * Test method for
345      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
346      * removeGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.
347      * RemoveGroupInput)}
348      * .
349      * @throws ExecutionException 
350      * @throws InterruptedException 
351      */
352     @Test
353     public void testRemoveGroup() throws InterruptedException, ExecutionException {
354         UpdateGroupOutputBuilder updateGroupOutput = new UpdateGroupOutputBuilder();
355         updateGroupOutput.setTransactionId(new TransactionId(new BigInteger("42")));
356         Set<RpcError> errorSet = Collections.emptySet();
357         RpcResult<UpdateGroupOutput> result = Rpcs.getRpcResult(true, updateGroupOutput.build(), errorSet);
358         Mockito.when(
359                 messageDispatchService.groupMod(Matchers.any(GroupModInput.class),
360                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
361
362         RemoveGroupInputBuilder input = new RemoveGroupInputBuilder();
363         input.setGroupId(new GroupId(789L));
364         input.setGroupType(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes.GroupFf);
365
366         mdSwitchOF10.removeGroup(input.build()).get();
367         mdSwitchOF13.removeGroup(input.build()).get();
368         Mockito.verify(messageDispatchService, Mockito.times(2)).groupMod(
369                 Matchers.any(GroupModInput.class),
370                 Matchers.any(SwitchConnectionDistinguisher.class));
371     }
372     
373     /**
374      * Test method for
375      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
376      * addMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.
377      * AddMeterInput)}
378      * .
379      * @throws ExecutionException 
380      * @throws InterruptedException 
381      */
382     @Test
383     public void testAddMeter() throws InterruptedException, ExecutionException {
384         UpdateMeterOutputBuilder updateMeterOutput = new UpdateMeterOutputBuilder();
385         updateMeterOutput.setTransactionId(new TransactionId(new BigInteger("42")));
386         Set<RpcError> errorSet = Collections.emptySet();
387         RpcResult<UpdateMeterOutput> result = Rpcs.getRpcResult(true, updateMeterOutput.build(), errorSet);
388         Mockito.when(
389                 messageDispatchService.meterMod(Matchers.any(MeterModInput.class),
390                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
391
392         AddMeterInputBuilder input = new AddMeterInputBuilder();
393         input.setMeterId(new MeterId(78L));
394
395         mdSwitchOF10.addMeter(input.build()).get();
396         mdSwitchOF13.addMeter(input.build()).get();
397         Mockito.verify(messageDispatchService, Mockito.times(2)).meterMod(
398                 Matchers.any(MeterModInput.class),
399                 Matchers.any(SwitchConnectionDistinguisher.class));
400     }
401     
402     /**
403      * Test method for
404      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
405      * updateMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.
406      * UpdateMeterInput)}
407      * .
408      * @throws ExecutionException 
409      * @throws InterruptedException 
410      */
411     @Test
412     public void testUpdtateMeter() throws InterruptedException, ExecutionException {
413         UpdateMeterOutputBuilder updateMeterOutput = new UpdateMeterOutputBuilder();
414         updateMeterOutput.setTransactionId(new TransactionId(new BigInteger("42")));
415         Set<RpcError> errorSet = Collections.emptySet();
416         RpcResult<UpdateMeterOutput> result = Rpcs.getRpcResult(true, updateMeterOutput.build(), errorSet);
417         Mockito.when(
418                 messageDispatchService.meterMod(Matchers.any(MeterModInput.class),
419                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
420
421         UpdateMeterInputBuilder input = new UpdateMeterInputBuilder();
422         UpdatedMeterBuilder updatedMeterBuilder = new UpdatedMeterBuilder();
423         updatedMeterBuilder.setMeterId(new MeterId(89L));
424         updatedMeterBuilder.setBarrier(false);
425         input.setUpdatedMeter(updatedMeterBuilder.build());
426
427         mdSwitchOF10.updateMeter(input.build()).get();
428         mdSwitchOF13.updateMeter(input.build()).get();
429         Mockito.verify(messageDispatchService, Mockito.times(2)).meterMod(
430                 Matchers.any(MeterModInput.class),
431                 Matchers.any(SwitchConnectionDistinguisher.class));
432     }
433     
434     /**
435      * Test method for
436      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
437      * removeMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.
438      * RemoveMeterInput)}
439      * .
440      * @throws ExecutionException 
441      * @throws InterruptedException 
442      */
443     @Test
444     public void testRemoveMeter() throws InterruptedException, ExecutionException {
445         UpdateMeterOutputBuilder updateMeterOutput = new UpdateMeterOutputBuilder();
446         updateMeterOutput.setTransactionId(new TransactionId(new BigInteger("42")));
447         Set<RpcError> errorSet = Collections.emptySet();
448         RpcResult<UpdateMeterOutput> result = Rpcs.getRpcResult(true, updateMeterOutput.build(), errorSet);
449         Mockito.when(
450                 messageDispatchService.meterMod(Matchers.any(MeterModInput.class),
451                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
452
453         RemoveMeterInputBuilder input = new RemoveMeterInputBuilder();
454         input.setMeterId(new MeterId(89L));
455         
456         mdSwitchOF10.removeMeter(input.build()).get();
457         mdSwitchOF13.removeMeter(input.build()).get();
458         Mockito.verify(messageDispatchService, Mockito.times(2)).meterMod(
459                 Matchers.any(MeterModInput.class),
460                 Matchers.any(SwitchConnectionDistinguisher.class));
461     }
462     
463     /**
464      * Test method for
465      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
466      * getAllGroupStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
467      * GetAllGroupStatisticsInput)}
468      * .
469      * @throws ExecutionException 
470      * @throws InterruptedException 
471      */
472     @Test
473     public void testGetAllGroupStatistics() throws InterruptedException, ExecutionException {
474         GetAllGroupStatisticsOutputBuilder getAllGroupStatistcsOutput = new GetAllGroupStatisticsOutputBuilder();
475         getAllGroupStatistcsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
476         Set<RpcError> errorSet = Collections.emptySet();
477         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
478         Mockito.when(
479                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
480                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
481
482         GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
483
484         mdSwitchOF10.getAllGroupStatistics(input.build()).get();
485         mdSwitchOF13.getAllGroupStatistics(input.build()).get();
486         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
487                 Matchers.any(MultipartRequestInput.class),
488                 Matchers.any(SwitchConnectionDistinguisher.class));
489     }
490     
491     /**
492      * Test method for
493      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
494      * getGroupDescription(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
495      * GetGroupDescriptionInput)}
496      * .
497      * @throws ExecutionException 
498      * @throws InterruptedException 
499      */
500     @Test
501     public void testGetGroupDescription() throws InterruptedException, ExecutionException {
502         GetGroupDescriptionOutputBuilder getGroupDescOutput = new GetGroupDescriptionOutputBuilder();
503         getGroupDescOutput.setTransactionId(new TransactionId(new BigInteger("42")));
504         Set<RpcError> errorSet = Collections.emptySet();
505         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
506         Mockito.when(
507                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
508                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
509
510         GetGroupDescriptionInputBuilder input = new GetGroupDescriptionInputBuilder();
511
512         mdSwitchOF10.getGroupDescription(input.build()).get();
513         mdSwitchOF13.getGroupDescription(input.build()).get();
514         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
515                 Matchers.any(MultipartRequestInput.class),
516                 Matchers.any(SwitchConnectionDistinguisher.class));
517     }
518     
519     /**
520      * Test method for
521      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
522      * getGroupFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
523      * GetGroupFeaturesInput)}
524      * .
525      * @throws ExecutionException 
526      * @throws InterruptedException 
527      */
528     @Test
529     public void testGetGroupFeatures() throws InterruptedException, ExecutionException {
530         GetGroupFeaturesOutputBuilder getGroupFeaturesOutput = new GetGroupFeaturesOutputBuilder();
531         getGroupFeaturesOutput.setTransactionId(new TransactionId(new BigInteger("42")));
532         Set<RpcError> errorSet = Collections.emptySet();
533         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
534         Mockito.when(
535                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
536                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
537
538         GetGroupFeaturesInputBuilder input = new GetGroupFeaturesInputBuilder();
539
540         mdSwitchOF10.getGroupFeatures(input.build()).get();
541         mdSwitchOF13.getGroupFeatures(input.build()).get();
542         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
543                 Matchers.any(MultipartRequestInput.class),
544                 Matchers.any(SwitchConnectionDistinguisher.class));
545     }
546     
547     /**
548      * Test method for
549      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
550      * getGroupStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
551      * GetGroupStatisticsInput)}
552      * .
553      * @throws ExecutionException 
554      * @throws InterruptedException 
555      */
556     //TODO GetGroupStatistics why NPE?
557     @Test
558     public void testGetGroupStatistics() throws InterruptedException, ExecutionException {
559         GetGroupStatisticsOutputBuilder getGroupStatsOutput = new GetGroupStatisticsOutputBuilder();
560         getGroupStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
561         Set<RpcError> errorSet = Collections.emptySet();
562         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
563         Mockito.when(
564                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
565                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
566
567         GetGroupStatisticsInputBuilder input = new GetGroupStatisticsInputBuilder();
568         input.setGroupId(new GroupId(42L));
569
570         mdSwitchOF10.getGroupStatistics(input.build()).get();
571         mdSwitchOF13.getGroupStatistics(input.build()).get();
572         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
573                 Matchers.any(MultipartRequestInput.class),
574                 Matchers.any(SwitchConnectionDistinguisher.class));
575     }
576     
577     /**
578      * Test method for
579      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
580      * getAllMeterConfigStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
581      * GetAllMeterConfigStatisticsInput)}
582      * .
583      * @throws ExecutionException 
584      * @throws InterruptedException 
585      */
586     @Test
587     public void testGetAllMeterConfigStatistics() throws InterruptedException, ExecutionException {
588         GetAllMeterConfigStatisticsOutputBuilder getAllMeterConfigStatsOutput = 
589                 new GetAllMeterConfigStatisticsOutputBuilder();
590         getAllMeterConfigStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
591         Set<RpcError> errorSet = Collections.emptySet();
592         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
593         Mockito.when(
594                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
595                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
596
597         GetAllMeterConfigStatisticsInputBuilder input = new GetAllMeterConfigStatisticsInputBuilder();
598
599         mdSwitchOF10.getAllMeterConfigStatistics(input.build()).get();
600         mdSwitchOF13.getAllMeterConfigStatistics(input.build()).get();
601         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
602                 Matchers.any(MultipartRequestInput.class),
603                 Matchers.any(SwitchConnectionDistinguisher.class));
604     }
605     
606     /**
607      * Test method for
608      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
609      * getAllMeterStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
610      * GetAllMeterStatisticsInput)}
611      * .
612      * @throws ExecutionException 
613      * @throws InterruptedException 
614      */
615     @Test
616     public void testGetAllMeterStatistics() throws InterruptedException, ExecutionException {
617         GetAllMeterStatisticsOutputBuilder getAllMeterStatisticsOutput = 
618                 new GetAllMeterStatisticsOutputBuilder();
619         getAllMeterStatisticsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
620         Set<RpcError> errorSet = Collections.emptySet();
621         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
622         Mockito.when(
623                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
624                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
625
626         GetAllMeterStatisticsInputBuilder input = new GetAllMeterStatisticsInputBuilder();
627
628         mdSwitchOF10.getAllMeterStatistics(input.build()).get();
629         mdSwitchOF13.getAllMeterStatistics(input.build()).get();
630         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
631                 Matchers.any(MultipartRequestInput.class),
632                 Matchers.any(SwitchConnectionDistinguisher.class));
633     }
634     
635     /**
636      * Test method for
637      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
638      * getMeterFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
639      * GetMeterFeaturesInput)}
640      * .
641      * @throws ExecutionException 
642      * @throws InterruptedException 
643      */
644     @Test
645     public void testGetMeterFeatures() throws InterruptedException, ExecutionException {
646         GetMeterFeaturesOutputBuilder getMeterFeaturesOutput = 
647                 new GetMeterFeaturesOutputBuilder();
648         getMeterFeaturesOutput.setTransactionId(new TransactionId(new BigInteger("42")));
649         Set<RpcError> errorSet = Collections.emptySet();
650         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
651         Mockito.when(
652                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
653                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
654
655         GetMeterFeaturesInputBuilder input = new GetMeterFeaturesInputBuilder();
656
657         mdSwitchOF10.getMeterFeatures(input.build()).get();
658         mdSwitchOF13.getMeterFeatures(input.build()).get();
659         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
660                 Matchers.any(MultipartRequestInput.class),
661                 Matchers.any(SwitchConnectionDistinguisher.class));
662     }
663     
664     /**
665      * Test method for
666      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
667      * getMeterStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
668      * GetMeterStatisticsInput)}
669      * .
670      * @throws ExecutionException 
671      * @throws InterruptedException 
672      */
673     @Test
674     public void testGetMeterStatistics() throws InterruptedException, ExecutionException {
675         GetMeterStatisticsOutputBuilder getMeterStatsOutput = new GetMeterStatisticsOutputBuilder();
676         getMeterStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
677         Set<RpcError> errorSet = Collections.emptySet();
678         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
679         Mockito.when(
680                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
681                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
682
683         GetMeterStatisticsInputBuilder input = new GetMeterStatisticsInputBuilder();
684         input.setMeterId(new MeterId(42L));
685
686         mdSwitchOF10.getMeterStatistics(input.build()).get();
687         mdSwitchOF13.getMeterStatistics(input.build()).get();
688         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
689                 Matchers.any(MultipartRequestInput.class),
690                 Matchers.any(SwitchConnectionDistinguisher.class));
691     }
692     
693     /**
694      * Test method for
695      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
696      * getAllNodeConnectorsStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.
697      * GetAllNodeConnectorsStatisticsInput)}
698      * .
699      * @throws ExecutionException 
700      * @throws InterruptedException 
701      */
702     @Test
703     public void testGetAllNodeConnectorsStatistics() throws InterruptedException, ExecutionException {
704         GetAllNodeConnectorsStatisticsOutputBuilder getAllNodeConnectorsStatsOutput = 
705                 new GetAllNodeConnectorsStatisticsOutputBuilder();
706         getAllNodeConnectorsStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
707         Set<RpcError> errorSet = Collections.emptySet();
708         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
709         Mockito.when(
710                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
711                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
712
713         GetAllNodeConnectorsStatisticsInputBuilder input = new GetAllNodeConnectorsStatisticsInputBuilder();
714
715         mdSwitchOF10.getAllNodeConnectorsStatistics(input.build()).get();
716         mdSwitchOF13.getAllNodeConnectorsStatistics(input.build()).get();
717         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
718                 Matchers.any(MultipartRequestInput.class),
719                 Matchers.any(SwitchConnectionDistinguisher.class));
720     }
721     
722     /**
723      * Test method for
724      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
725      * getNodeConnectorStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.
726      * GetNodeConnectorStatisticsInput)}
727      * .
728      * @throws ExecutionException 
729      * @throws InterruptedException 
730      */
731     @Test
732     public void testGetNodeConnectorStatistics() throws InterruptedException, ExecutionException {
733         GetNodeConnectorStatisticsOutputBuilder getNodeConnectorStatsOutput = 
734                 new GetNodeConnectorStatisticsOutputBuilder();
735         getNodeConnectorStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
736         Set<RpcError> errorSet = Collections.emptySet();
737         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
738         Mockito.when(
739                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
740                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
741
742         GetNodeConnectorStatisticsInputBuilder input = new GetNodeConnectorStatisticsInputBuilder();
743         input.setNodeConnectorId(new NodeConnectorId("openflow:12:8"));
744         
745         Mockito.when(features.getVersion()).thenReturn((short)1);
746         mdSwitchOF10.getNodeConnectorStatistics(input.build()).get();
747         Mockito.when(features.getVersion()).thenReturn((short)4);
748         mdSwitchOF13.getNodeConnectorStatistics(input.build()).get();
749         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
750                 Matchers.any(MultipartRequestInput.class),
751                 Matchers.any(SwitchConnectionDistinguisher.class));
752     }
753     
754     /**
755      * Test method for
756      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
757      * updatePort(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.
758      * UpdatePortInput)}
759      * .
760      * @throws ExecutionException 
761      * @throws InterruptedException 
762      */
763     @Test
764     public void testUpdatePort() throws InterruptedException, ExecutionException {
765         UpdatePortOutputBuilder updatePortOutput = new UpdatePortOutputBuilder();
766         updatePortOutput.setTransactionId(new TransactionId(new BigInteger("42")));
767         Set<RpcError> errorSet = Collections.emptySet();
768         RpcResult<UpdatePortOutput> result = Rpcs.getRpcResult(true, updatePortOutput.build(), errorSet);
769         Mockito.when(
770                 messageDispatchService.portMod(Matchers.any(PortModInput.class),
771                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
772
773         UpdatePortInputBuilder input = new UpdatePortInputBuilder();
774         
775         PortBuilder portBuilder = new PortBuilder();
776         List<Port> ports = new ArrayList<Port>();
777         ports.add(createPort()); 
778         portBuilder.setPort(ports);
779         UpdatedPortBuilder updatedPortBuilder = new UpdatedPortBuilder();
780         updatedPortBuilder.setPort(portBuilder.build());
781         input.setUpdatedPort(updatedPortBuilder.build());
782
783         mdSwitchOF10.updatePort(input.build()).get();
784         mdSwitchOF13.updatePort(input.build()).get();
785         Mockito.verify(messageDispatchService, Mockito.times(2)).portMod(
786                 Matchers.any(PortModInput.class),
787                 Matchers.any(SwitchConnectionDistinguisher.class));
788     }
789     
790     private static Port createPort() {
791         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder port = 
792                 new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder();
793         
794         port.setPortName("TestingPort01");
795         port.setMask(new PortConfig(true, true, true, true));
796         port.setConfiguration(new PortConfig(true, true, true, true));
797         port.setAdvertisedFeatures(new PortFeatures(true, true, true, true, 
798                                                     false, false, false, false, 
799                                                     true, true, true, true,
800                                                     false, false, false, false));
801         port.setPortNumber(new PortNumberUni(42L));
802         port.setHardwareAddress(new MacAddress("01:23:45:67:89:ab"));
803         port.setBarrier(true);
804         port.setContainerName("TestContainer");
805         port.setPortModOrder(25L);
806         port.setKey(new PortKey(25L));
807         return port.build();
808     }
809     
810     /**
811      * Test method for
812      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
813      * updateTable(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.
814      * UpdateTableInput)}
815      * .
816      * @throws ExecutionException 
817      * @throws InterruptedException 
818      */
819     @Test
820     public void testUpdateTable() throws InterruptedException, ExecutionException {
821         UpdateTableOutputBuilder updateTableOutput = new UpdateTableOutputBuilder();
822         updateTableOutput.setTransactionId(new TransactionId(new BigInteger("42")));
823         Set<RpcError> errorSet = Collections.emptySet();
824         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
825         Mockito.when(
826                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
827                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
828
829         UpdateTableInputBuilder input = new UpdateTableInputBuilder();
830         input.setUpdatedTable(createUpdateTable());
831
832         mdSwitchOF10.updateTable(input.build()).get();
833         mdSwitchOF13.updateTable(input.build()).get();
834         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
835                 Matchers.any(MultipartRequestInput.class),
836                 Matchers.any(SwitchConnectionDistinguisher.class));
837     }
838     
839     private static UpdatedTable createUpdateTable() {
840         UpdatedTableBuilder updatedTableBuilder = new UpdatedTableBuilder();
841         TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
842         tableFeaturesBuilder.setConfig(new TableConfig(true));
843         tableFeaturesBuilder.setKey(new TableFeaturesKey((short) 42));
844         tableFeaturesBuilder.setMaxEntries(42L);
845         tableFeaturesBuilder.setMetadataMatch(new BigInteger("42424242"));
846         tableFeaturesBuilder.setMetadataWrite(new BigInteger("42424242"));
847         tableFeaturesBuilder.setName("testTableFeatures");
848         tableFeaturesBuilder.setTableId((short) 41);
849         
850         TablePropertiesBuilder tablePropertiesBuilder = new TablePropertiesBuilder();
851         TableFeaturePropertiesBuilder tableFeaturePropertiesBuilder = new TableFeaturePropertiesBuilder();
852         tableFeaturePropertiesBuilder.setKey(new TableFeaturePropertiesKey(45));
853         tableFeaturePropertiesBuilder.setOrder(44);
854         tableFeaturePropertiesBuilder.setTableFeaturePropType(new ApplySetfieldBuilder().build());
855         List<TableFeatureProperties> tableFeatureProperties = new ArrayList<TableFeatureProperties>();
856         tableFeatureProperties.add(tableFeaturePropertiesBuilder.build());
857         tablePropertiesBuilder.setTableFeatureProperties(tableFeatureProperties);
858         
859         tableFeaturesBuilder.setTableProperties(tablePropertiesBuilder.build());
860         List<TableFeatures> tableFeatures = new ArrayList<TableFeatures>();
861         tableFeatures.add(tableFeaturesBuilder.build());
862         updatedTableBuilder.setTableFeatures(tableFeatures);
863         return updatedTableBuilder.build();
864     }
865     
866     /**
867      * Test method for
868      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
869      * getAllFlowStatisticsFromFlowTable(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
870      * GetAllFlowStatisticsFromFlowTableInput)}
871      * .
872      * @throws ExecutionException 
873      * @throws InterruptedException 
874      */
875     @Test
876     public void testGetAllFlowStatisticsFromFlowTable() throws InterruptedException, ExecutionException {
877         GetAllFlowStatisticsFromFlowTableOutputBuilder allFlowStatisticsFromFlowTableOutput = 
878                 new GetAllFlowStatisticsFromFlowTableOutputBuilder();
879         allFlowStatisticsFromFlowTableOutput.setTransactionId(new TransactionId(new BigInteger("42")));
880         Set<RpcError> errorSet = Collections.emptySet();
881         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
882         Mockito.when(
883                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
884                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
885
886         GetAllFlowStatisticsFromFlowTableInputBuilder input = new GetAllFlowStatisticsFromFlowTableInputBuilder();
887         input.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId((short) 42));
888
889         mdSwitchOF10.getAllFlowStatisticsFromFlowTable(input.build()).get();
890         mdSwitchOF13.getAllFlowStatisticsFromFlowTable(input.build()).get();
891         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
892                 Matchers.any(MultipartRequestInput.class),
893                 Matchers.any(SwitchConnectionDistinguisher.class));
894     }
895     
896     /**
897      * Test method for
898      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
899      * getAllFlowStatisticsFromFlowTable(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
900      * GetAllFlowStatisticsFromFlowTableInput)}
901      * .
902      * @throws ExecutionException 
903      * @throws InterruptedException 
904      */
905     @Test
906     public void testGetAllFlowsStatisticsFromAllFlowTables() throws InterruptedException, ExecutionException {
907         GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder allFlowStatisticsFromAllFlowTablesOutput = 
908                 new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder();
909         allFlowStatisticsFromAllFlowTablesOutput.setTransactionId(new TransactionId(new BigInteger("42")));
910         Set<RpcError> errorSet = Collections.emptySet();
911         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
912         Mockito.when(
913                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
914                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
915
916         GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input = 
917                                     new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder();
918
919         mdSwitchOF10.getAllFlowsStatisticsFromAllFlowTables(input.build()).get();
920         mdSwitchOF13.getAllFlowsStatisticsFromAllFlowTables(input.build()).get();
921         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
922                 Matchers.any(MultipartRequestInput.class),
923                 Matchers.any(SwitchConnectionDistinguisher.class));
924     }
925     
926     /**
927      * Test method for
928      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
929      * getAllFlowStatisticsFromFlowTable(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
930      * GetAllFlowStatisticsFromFlowTableInput)}
931      * .
932      * @throws ExecutionException 
933      * @throws InterruptedException 
934      */
935     @Test
936     public void testGetFlowStatisticsFromFlowTables() throws InterruptedException, ExecutionException {
937         GetFlowStatisticsFromFlowTableOutputBuilder flowStatisticsFromFlowTablesOutput = 
938                 new GetFlowStatisticsFromFlowTableOutputBuilder();
939         flowStatisticsFromFlowTablesOutput.setTransactionId(new TransactionId(new BigInteger("42")));
940         Set<RpcError> errorSet = Collections.emptySet();
941         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
942         Mockito.when(
943                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
944                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
945
946         GetFlowStatisticsFromFlowTableInputBuilder input = 
947                                     new GetFlowStatisticsFromFlowTableInputBuilder();
948         input.setMatch(createMatch()); 
949
950         mdSwitchOF10.getFlowStatisticsFromFlowTable(input.build()).get();
951         mdSwitchOF13.getFlowStatisticsFromFlowTable(input.build()).get();
952         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
953                 Matchers.any(MultipartRequestInput.class),
954                 Matchers.any(SwitchConnectionDistinguisher.class));
955     }
956     
957     private static Match createMatch() {
958         MatchBuilder matchBuilder = new MatchBuilder(); 
959         EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
960         EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
961         ethernetDestinationBuilder.setAddress(new MacAddress("01:23:45:67:89:ab"));
962         ethernetDestinationBuilder.setMask(new MacAddress("01:23:45:67:89:ab"));
963         ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build()); 
964         EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
965         ethernetSourceBuilder.setAddress(new MacAddress("01:23:45:67:89:ab"));
966         ethernetSourceBuilder.setMask(new MacAddress("01:23:45:67:89:ab"));
967         ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build()); 
968         ethernetMatchBuilder.setEthernetType(new EthernetTypeBuilder().setType(new EtherType(42L)).build()); 
969         matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
970         return matchBuilder.build();
971     }
972     
973     /**
974      * Test method for
975      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
976      * getAggregateFlowStatisticsFromFlowTableForAllFlows(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
977      * GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput)}
978      * .
979      * @throws ExecutionException 
980      * @throws InterruptedException 
981      */
982     @Test
983     public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws InterruptedException, 
984                                                                                 ExecutionException {
985         GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder aggregateFlowStatisticsOutput = 
986                 new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder();
987         aggregateFlowStatisticsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
988         Set<RpcError> errorSet = Collections.emptySet();
989         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
990         Mockito.when(
991                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
992                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
993
994         GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = 
995                            new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder();
996         input.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId((short) 42));
997
998         mdSwitchOF10.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build()).get();
999         mdSwitchOF13.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build()).get();
1000         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
1001                 Matchers.any(MultipartRequestInput.class),
1002                 Matchers.any(SwitchConnectionDistinguisher.class));
1003     }
1004     
1005     /**
1006      * Test method for
1007      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
1008      * getAggregateFlowStatisticsFromFlowTableForGivenMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
1009      * GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput)}
1010      * .
1011      * @throws ExecutionException 
1012      * @throws InterruptedException 
1013      */
1014     @Test
1015     public void testGetAggregateFlowStatisticsFromFlowTableForGivenMatch() throws InterruptedException, 
1016                                                                                 ExecutionException {
1017         GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder aggregateFlowStatisticsForMatchOutput = 
1018                 new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder();
1019         aggregateFlowStatisticsForMatchOutput.setTransactionId(new TransactionId(new BigInteger("42")));
1020         Set<RpcError> errorSet = Collections.emptySet();
1021         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
1022         Mockito.when(
1023                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
1024                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
1025
1026         GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder input = 
1027                            new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder();
1028         input.setMatch(createMatch());
1029         input.setCookie(new FlowCookie(new BigInteger("123456")));
1030         input.setCookieMask(new FlowCookie(new BigInteger("123456")));
1031         input.setOutGroup(44L);
1032         input.setOutPort(new BigInteger("12563"));
1033
1034         mdSwitchOF10.getAggregateFlowStatisticsFromFlowTableForGivenMatch(input.build()).get();
1035         mdSwitchOF13.getAggregateFlowStatisticsFromFlowTableForGivenMatch(input.build()).get();
1036         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
1037                 Matchers.any(MultipartRequestInput.class),
1038                 Matchers.any(SwitchConnectionDistinguisher.class));
1039     }
1040     
1041     /**
1042      * Test method for
1043      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
1044      * getFlowTablesStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.
1045      * GetFlowTablesStatisticsInput)}
1046      * .
1047      * @throws ExecutionException 
1048      * @throws InterruptedException 
1049      */
1050     @Test
1051     public void testGetFlowTablesStatistics() throws InterruptedException, ExecutionException {
1052         GetFlowTablesStatisticsOutputBuilder flowTableStatisticsOutput = 
1053                 new GetFlowTablesStatisticsOutputBuilder();
1054         flowTableStatisticsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
1055         Set<RpcError> errorSet = Collections.emptySet();
1056         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
1057         Mockito.when(
1058                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
1059                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
1060
1061         GetFlowTablesStatisticsInputBuilder input = new GetFlowTablesStatisticsInputBuilder();
1062
1063         mdSwitchOF10.getFlowTablesStatistics(input.build()).get();
1064         mdSwitchOF13.getFlowTablesStatistics(input.build()).get();
1065         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
1066                 Matchers.any(MultipartRequestInput.class),
1067                 Matchers.any(SwitchConnectionDistinguisher.class));
1068     }
1069     
1070     /**
1071      * Test method for
1072      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
1073      * getAllQueuesStatisticsFromAllPorts(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
1074      * GetAllQueuesStatisticsFromAllPortsInput)}
1075      * .
1076      * @throws ExecutionException 
1077      * @throws InterruptedException 
1078      */
1079     @Test
1080     public void testGetAllQueuesStatisticsFromAllPorts() throws InterruptedException, ExecutionException {
1081         GetAllQueuesStatisticsFromAllPortsOutputBuilder allQueuesStatisticsAllPortsOutput = 
1082                 new GetAllQueuesStatisticsFromAllPortsOutputBuilder();
1083         allQueuesStatisticsAllPortsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
1084         Set<RpcError> errorSet = Collections.emptySet();
1085         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
1086         Mockito.when(
1087                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
1088                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
1089
1090         GetAllQueuesStatisticsFromAllPortsInputBuilder input = 
1091                 new GetAllQueuesStatisticsFromAllPortsInputBuilder();
1092
1093         mdSwitchOF10.getAllQueuesStatisticsFromAllPorts(input.build()).get();
1094         mdSwitchOF13.getAllQueuesStatisticsFromAllPorts(input.build()).get();
1095         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
1096                 Matchers.any(MultipartRequestInput.class),
1097                 Matchers.any(SwitchConnectionDistinguisher.class));
1098     }
1099     
1100     /**
1101      * Test method for
1102      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
1103      * getAllQueuesStatisticsFromGivenPort(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
1104      * GetAllQueuesStatisticsFromGivenPortInput)}
1105      * .
1106      * @throws ExecutionException 
1107      * @throws InterruptedException 
1108      */
1109     @Test
1110     public void testGetAllQueuesStatisticsFromGivenPort() throws InterruptedException, ExecutionException {
1111         GetAllQueuesStatisticsFromGivenPortOutputBuilder allQueuesStatisticsGivenPortsOutput = 
1112                 new GetAllQueuesStatisticsFromGivenPortOutputBuilder();
1113         allQueuesStatisticsGivenPortsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
1114         Set<RpcError> errorSet = Collections.emptySet();
1115         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
1116         Mockito.when(
1117                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
1118                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
1119
1120         GetAllQueuesStatisticsFromGivenPortInputBuilder input = 
1121                 new GetAllQueuesStatisticsFromGivenPortInputBuilder();
1122         input.setNodeConnectorId(new NodeConnectorId("openflow:12:8"));
1123         
1124         Mockito.when(features.getVersion()).thenReturn((short)1);
1125         mdSwitchOF10.getAllQueuesStatisticsFromGivenPort(input.build()).get();
1126         Mockito.when(features.getVersion()).thenReturn((short)4);
1127         mdSwitchOF13.getAllQueuesStatisticsFromGivenPort(input.build()).get();
1128         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
1129                 Matchers.any(MultipartRequestInput.class),
1130                 Matchers.any(SwitchConnectionDistinguisher.class));
1131     }
1132     
1133     /**
1134      * Test method for
1135      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
1136      * getQueueStatisticsFromGivenPort(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
1137      * GetQueueStatisticsFromGivenPortInput)}
1138      * .
1139      * @throws ExecutionException 
1140      * @throws InterruptedException 
1141      */
1142     @Test
1143     public void testGetQueueStatisticsFromGivenPort() throws InterruptedException, ExecutionException {
1144         GetQueueStatisticsFromGivenPortOutputBuilder queuesStatisticsGivenPortOutput = 
1145                 new GetQueueStatisticsFromGivenPortOutputBuilder();
1146         queuesStatisticsGivenPortOutput.setTransactionId(new TransactionId(new BigInteger("42")));
1147         Set<RpcError> errorSet = Collections.emptySet();
1148         RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
1149         Mockito.when(
1150                 messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
1151                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
1152
1153         GetQueueStatisticsFromGivenPortInputBuilder input = 
1154                 new GetQueueStatisticsFromGivenPortInputBuilder();
1155         input.setNodeConnectorId(new NodeConnectorId("openflow:12:8"));
1156         input.setQueueId(new QueueId(55L));
1157         
1158         Mockito.when(features.getVersion()).thenReturn((short)1);
1159         mdSwitchOF10.getQueueStatisticsFromGivenPort(input.build()).get();
1160         Mockito.when(features.getVersion()).thenReturn((short)4);
1161         mdSwitchOF13.getQueueStatisticsFromGivenPort(input.build()).get();
1162         Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
1163                 Matchers.any(MultipartRequestInput.class),
1164                 Matchers.any(SwitchConnectionDistinguisher.class));
1165     }
1166 }