2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.openflowplugin.impl.registry.flow;
11 import java.math.BigInteger;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
21 * flow building helper
23 public class TestFlowHelper {
26 * @return flow stats builder with dummy content
28 protected static FlowAndStatisticsMapListBuilder createFlowAndStatisticsMapListBuilder(int i) {
29 FlowAndStatisticsMapListBuilder flowAndStatisticsMapListBuilder = new FlowAndStatisticsMapListBuilder();
30 flowAndStatisticsMapListBuilder.setPriority(i);
31 flowAndStatisticsMapListBuilder.setTableId((short) i);
32 flowAndStatisticsMapListBuilder.setCookie(new FlowCookie(BigInteger.TEN));
34 MatchBuilder matchBuilder = new MatchBuilder();
36 EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
38 EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
39 MacAddress macAddress = new MacAddress("00:00:00:00:00:0" + i);
40 ethernetSourceBuilder.setAddress(macAddress);
41 ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build());
43 EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
44 ethernetDestinationBuilder.setAddress(new MacAddress("00:00:00:0" + i + ":00:00"));
45 ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build());
47 matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
49 flowAndStatisticsMapListBuilder.setMatch(matchBuilder.build());
50 return flowAndStatisticsMapListBuilder;