2 * Copyright (c) 2013 Big Switch Networks, Inc.
4 * Licensed under the Eclipse Public License, Version 1.0 (the
5 * "License"); you may not use this file except in compliance with the
6 * License. You may obtain a copy of the License at
8 * http://www.eclipse.org/legal/epl-v10.html
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 * implied. See the License for the specific language governing
14 * permissions and limitations under the License.
17 package org.opendaylight.controller.hosttracker.test;
19 import static org.opendaylight.controller.hosttracker.IDeviceService.DeviceField.MAC;
20 import static org.opendaylight.controller.hosttracker.IDeviceService.DeviceField.SWITCHPORT;
21 import static org.opendaylight.controller.hosttracker.IDeviceService.DeviceField.VLAN;
23 import java.util.EnumSet;
25 import org.opendaylight.controller.hosttracker.Entity;
26 import org.opendaylight.controller.hosttracker.IDeviceService;
27 import org.opendaylight.controller.hosttracker.IDeviceService.DeviceField;
28 import org.opendaylight.controller.hosttracker.IEntityClass;
29 import org.opendaylight.controller.hosttracker.internal.DefaultEntityClassifier;
32 * A simple IEntityClassifier. Useful for tests that need IEntityClassifiers and
33 * IEntityClass'es with switch and/or port key fields
35 public class MockEntityClassifier extends DefaultEntityClassifier {
36 public static class TestEntityClass implements IEntityClass {
38 public EnumSet<DeviceField> getKeyFields() {
39 return EnumSet.of(MAC, VLAN, SWITCHPORT);
43 public String getName() {
44 return "TestEntityClass";
48 public static IEntityClass testEC = new MockEntityClassifier.TestEntityClass();
51 public IEntityClass classifyEntity(Entity entity) {
52 if (((Long) entity.getPort().getNode().getID()) >= 10L) {
55 return DefaultEntityClassifier.entityClass;
59 public EnumSet<IDeviceService.DeviceField> getKeyFields() {
60 return EnumSet.of(MAC, VLAN, SWITCHPORT);