andrea | ed976a4 | 2015-10-05 14:38:25 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
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 | |
| 17 | package org.onosproject.ovsdb.controller.driver; |
| 18 | |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onlab.packet.TpPort; |
| 21 | import org.onosproject.ovsdb.controller.OvsdbClientService; |
| 22 | import org.onosproject.ovsdb.controller.OvsdbController; |
| 23 | import org.onosproject.ovsdb.controller.OvsdbEventListener; |
| 24 | import org.onosproject.ovsdb.controller.OvsdbNodeId; |
| 25 | import org.onosproject.ovsdb.controller.OvsdbNodeListener; |
| 26 | |
| 27 | import java.util.ArrayList; |
| 28 | import java.util.Arrays; |
| 29 | import java.util.List; |
| 30 | import java.util.concurrent.ConcurrentHashMap; |
| 31 | |
| 32 | /** |
| 33 | * Test Adapter for OvsdbController. |
| 34 | */ |
| 35 | public class OvsdbControllerAdapter implements OvsdbController { |
| 36 | protected ConcurrentHashMap<OvsdbNodeId, OvsdbClientServiceAdapter> ovsdbClients = |
| 37 | new ConcurrentHashMap<OvsdbNodeId, OvsdbClientServiceAdapter>(); |
| 38 | |
| 39 | @Override |
| 40 | public void addNodeListener(OvsdbNodeListener listener) { |
| 41 | |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public void removeNodeListener(OvsdbNodeListener listener) { |
| 46 | |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public void addOvsdbEventListener(OvsdbEventListener listener) { |
| 51 | |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public void removeOvsdbEventListener(OvsdbEventListener listener) { |
| 56 | |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public List<OvsdbNodeId> getNodeIds() { |
| 61 | long port = 6653; |
| 62 | return new ArrayList<OvsdbNodeId>(Arrays.asList( |
| 63 | new OvsdbNodeId(IpAddress.valueOf("127.0.0.1"), port))); |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public OvsdbClientService getOvsdbClient(OvsdbNodeId nodeId) { |
| 68 | return ovsdbClients.get(nodeId); |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public void connect(IpAddress ip, TpPort port) { |
| 73 | |
| 74 | } |
| 75 | } |