andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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 | |
| 17 | package org.onosproject.driver.ovsdb; |
| 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 | |
| 31 | /** |
| 32 | * Created by Andrea on 10/7/15. |
| 33 | */ |
| 34 | public class OvsdbControllerConfigTest { |
| 35 | |
| 36 | |
| 37 | private static final DeviceId DEVICE_ID = DeviceId.deviceId("foo"); |
| 38 | |
| 39 | private DefaultDriver ddc; |
| 40 | private DefaultDriverData data; |
| 41 | private DefaultDriverHandler handler; |
| 42 | |
| 43 | private TestDeviceService deviceService = new TestDeviceService(); |
| 44 | private TestOvsdbController controller = new TestOvsdbController(); |
| 45 | private TestOvsdbClient client = new TestOvsdbClient(); |
| 46 | |
| 47 | private OvsdbControllerConfig controllerConfig; |
| 48 | |
| 49 | |
| 50 | @Before |
| 51 | public void setUp() { |
| 52 | controllerConfig = new OvsdbControllerConfig(); |
| 53 | |
| 54 | ddc = new DefaultDriver("foo.bar", null, "Circus", "lux", "1.2a", |
| 55 | ImmutableMap.of(ControllerConfig.class, |
| 56 | OvsdbControllerConfig.class), |
| 57 | ImmutableMap.of("foo", "bar")); |
| 58 | data = new DefaultDriverData(ddc, DEVICE_ID); |
| 59 | handler = new DefaultDriverHandler(data); |
| 60 | //handler.controllerConfig.setHandler(handler); |
| 61 | //TODO setTestService directory on handler |
| 62 | //TODO setup ovsdb fake controller with fake ovsdbclient |
| 63 | //TODO setup fake device service |
| 64 | } |
| 65 | |
| 66 | @Test |
| 67 | public void testGetControllers() throws Exception { |
| 68 | // DriverService driverService = new Driv |
| 69 | // AbstractBehaviour ab = new AbstractBehaviour(); |
| 70 | // DriverHandler handler = handler(); |
| 71 | // List<ControllerInfo> controllersList = |
| 72 | // controllerConfig.getControllers(DeviceId.deviceId("0000000000000018")); |
| 73 | // log.info("controllers " + controllersList); |
| 74 | |
| 75 | } |
| 76 | |
| 77 | @Test |
| 78 | public void testSetControllers() throws Exception { |
| 79 | |
| 80 | } |
| 81 | |
| 82 | |
| 83 | private class TestDeviceService extends DeviceServiceAdapter { |
| 84 | |
| 85 | } |
| 86 | |
| 87 | private class TestOvsdbController extends OvsdbControllerAdapter { |
| 88 | |
| 89 | |
| 90 | } |
| 91 | |
| 92 | private class TestOvsdbClient extends OvsdbClientServiceAdapter { |
| 93 | |
| 94 | } |
| 95 | } |