andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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 implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Andrea Campanella | 238d96e | 2016-01-20 11:52:02 -0800 | [diff] [blame] | 17 | package org.onosproject.drivers.ovsdb; |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 18 | |
| 19 | import com.google.common.collect.ImmutableMap; |
| 20 | import org.junit.Before; |
| 21 | import org.junit.Test; |
| 22 | import org.onosproject.net.DeviceId; |
| 23 | import org.onosproject.net.behaviour.ControllerConfig; |
| 24 | import org.onosproject.net.device.DeviceServiceAdapter; |
| 25 | import org.onosproject.net.driver.DefaultDriver; |
| 26 | import org.onosproject.net.driver.DefaultDriverData; |
| 27 | import org.onosproject.net.driver.DefaultDriverHandler; |
| 28 | import org.onosproject.ovsdb.controller.driver.OvsdbClientServiceAdapter; |
| 29 | import org.onosproject.ovsdb.controller.driver.OvsdbControllerAdapter; |
| 30 | |
Andrea Campanella | 80520b8 | 2016-01-05 17:55:29 -0800 | [diff] [blame] | 31 | import java.util.ArrayList; |
| 32 | |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 33 | /** |
| 34 | * Created by Andrea on 10/7/15. |
| 35 | */ |
| 36 | public class OvsdbControllerConfigTest { |
| 37 | |
| 38 | |
| 39 | private static final DeviceId DEVICE_ID = DeviceId.deviceId("foo"); |
| 40 | |
| 41 | private DefaultDriver ddc; |
| 42 | private DefaultDriverData data; |
| 43 | private DefaultDriverHandler handler; |
| 44 | |
| 45 | private TestDeviceService deviceService = new TestDeviceService(); |
| 46 | private TestOvsdbController controller = new TestOvsdbController(); |
| 47 | private TestOvsdbClient client = new TestOvsdbClient(); |
| 48 | |
| 49 | private OvsdbControllerConfig controllerConfig; |
| 50 | |
| 51 | |
| 52 | @Before |
| 53 | public void setUp() { |
| 54 | controllerConfig = new OvsdbControllerConfig(); |
| 55 | |
Andrea Campanella | 80520b8 | 2016-01-05 17:55:29 -0800 | [diff] [blame] | 56 | ddc = new DefaultDriver("foo.bar", new ArrayList<>(), "Circus", "lux", "1.2a", |
andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 57 | ImmutableMap.of(ControllerConfig.class, |
| 58 | OvsdbControllerConfig.class), |
| 59 | ImmutableMap.of("foo", "bar")); |
| 60 | data = new DefaultDriverData(ddc, DEVICE_ID); |
| 61 | handler = new DefaultDriverHandler(data); |
| 62 | //handler.controllerConfig.setHandler(handler); |
| 63 | //TODO setTestService directory on handler |
| 64 | //TODO setup ovsdb fake controller with fake ovsdbclient |
| 65 | //TODO setup fake device service |
| 66 | } |
| 67 | |
| 68 | @Test |
| 69 | public void testGetControllers() throws Exception { |
| 70 | // DriverService driverService = new Driv |
| 71 | // AbstractBehaviour ab = new AbstractBehaviour(); |
| 72 | // DriverHandler handler = handler(); |
| 73 | // List<ControllerInfo> controllersList = |
| 74 | // controllerConfig.getControllers(DeviceId.deviceId("0000000000000018")); |
| 75 | // log.info("controllers " + controllersList); |
| 76 | |
| 77 | } |
| 78 | |
| 79 | @Test |
| 80 | public void testSetControllers() throws Exception { |
| 81 | |
| 82 | } |
| 83 | |
| 84 | |
| 85 | private class TestDeviceService extends DeviceServiceAdapter { |
| 86 | |
| 87 | } |
| 88 | |
| 89 | private class TestOvsdbController extends OvsdbControllerAdapter { |
| 90 | |
| 91 | |
| 92 | } |
| 93 | |
| 94 | private class TestOvsdbClient extends OvsdbClientServiceAdapter { |
| 95 | |
| 96 | } |
| 97 | } |