Avoid calling the String constructor explicitly
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / impl / BridgeConfigurationManagerImpl.java
1 /*
2  * Copyright (c) 2013, 2015 Red Hat, Inc. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.ovsdb.openstack.netvirt.impl;
10
11 import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork;
12 import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface;
13 import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
14 import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
15 import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
16 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
17 import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
18 import org.opendaylight.ovsdb.openstack.netvirt.api.OvsdbTables;
19 import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
20 import org.opendaylight.ovsdb.utils.config.ConfigProperties;
21 import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagerEntry;
25 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
26
27 import com.google.common.base.Preconditions;
28 import com.google.common.collect.Lists;
29
30 import java.net.InetAddress;
31 import java.net.NetworkInterface;
32 import java.net.UnknownHostException;
33 import java.util.ArrayList;
34 import java.util.Enumeration;
35 import java.util.List;
36
37 import org.apache.commons.lang3.tuple.ImmutablePair;
38 import org.osgi.framework.ServiceReference;
39 import org.slf4j.Logger;
40 import org.slf4j.LoggerFactory;
41
42 /**
43  * @author Madhu Venugopal
44  * @author Brent Salisbury
45  * @author Sam Hague (shague@redhat.com)
46  */
47 public class BridgeConfigurationManagerImpl implements BridgeConfigurationManager, ConfigInterface {
48     private static final Logger LOG = LoggerFactory.getLogger(BridgeConfigurationManagerImpl.class);
49
50     // The implementation for each of these services is resolved by the OSGi Service Manager
51     private volatile ConfigurationService configurationService;
52     private volatile NetworkingProviderManager networkingProviderManager;
53     private volatile Southbound southbound;
54
55     public void setConfigurationService(ConfigurationService configurationService) {
56         this.configurationService = configurationService;
57     }
58
59     public void setSouthbound(Southbound southbound) {
60         this.southbound = southbound;
61     }
62
63     @Override
64     public String getBridgeUuid(Node node, String bridgeName) {
65         return southbound.getBridgeUuid(node, bridgeName);
66     }
67
68     @Override
69     public boolean isNodeNeutronReady(Node node) {
70         Preconditions.checkNotNull(configurationService);
71         return southbound.getBridge(node, configurationService.getIntegrationBridgeName()) != null;
72     }
73
74     @Override
75     public boolean isNodeOverlayReady(Node node) {
76         Preconditions.checkNotNull(configurationService);
77         return isNodeNeutronReady(node)
78                 && southbound.getBridge(node, configurationService.getNetworkBridgeName()) != null;
79     }
80
81     @Override
82     public boolean isPortOnBridge (Node bridgeNode, String portName) {
83         return southbound.extractTerminationPointAugmentation(bridgeNode, portName) != null;
84     }
85
86     @Override
87     public boolean isNodeTunnelReady(Node bridgeNode, Node ovsdbNode) {
88         Preconditions.checkNotNull(configurationService);
89         if (!southbound.isBridgeOnOvsdbNode(ovsdbNode, configurationService.getIntegrationBridgeName())) {
90             LOG.trace("isNodeTunnelReady: node: {}, {} missing",
91                     bridgeNode, configurationService.getIntegrationBridgeName());
92             return false;
93         }
94
95         return isNodeL3Ready(bridgeNode, ovsdbNode);
96     }
97
98     @Override
99     public boolean isNodeVlanReady(Node bridgeNode, Node ovsdbNode, NeutronNetwork network) {
100         Preconditions.checkNotNull(configurationService);
101
102         final String brInt = configurationService.getIntegrationBridgeName();
103         if (!southbound.isBridgeOnOvsdbNode(ovsdbNode, brInt)) {
104             LOG.trace("isNodeVlanReady: node: {}, {} missing", bridgeNode, brInt);
105             return false;
106         }
107
108         /* Check if physical device is added to br-int. */
109         String phyNetName = getPhysicalInterfaceName(ovsdbNode, network.getProviderPhysicalNetwork());
110         if (!isPortOnBridge(bridgeNode, phyNetName)) {
111             LOG.trace("isNodeVlanReady: node: {}, eth missing", bridgeNode);
112             return false;
113         }
114
115         return isNodeL3Ready(bridgeNode, ovsdbNode);
116     }
117
118     public boolean isNodeL3Ready(Node bridgeNode, Node ovsdbNode) {
119         Preconditions.checkNotNull(configurationService);
120         boolean ready = false;
121         if (configurationService.isL3ForwardingEnabled()) {
122             final String brInt = configurationService.getIntegrationBridgeName();
123             final String brExt = configurationService.getExternalBridgeName();
124             final String portNameInt = configurationService.getPatchPortName(new ImmutablePair<>(brInt, brExt));
125             final String portNameExt = configurationService.getPatchPortName(new ImmutablePair<>(brExt, brInt));
126             Preconditions.checkNotNull(portNameInt);
127             Preconditions.checkNotNull(portNameExt);
128
129             if (southbound.isBridgeOnOvsdbNode(ovsdbNode, brExt)) {
130                 ready = isNetworkPatchCreated(bridgeNode, southbound.readBridgeNode(ovsdbNode, brExt));
131             } else {
132                 LOG.trace("isNodeL3Ready: node: {}, {} missing",
133                         bridgeNode, brExt);
134             }
135         } else {
136             ready = true;
137         }
138         return ready;
139     }
140
141     @Override
142     public void prepareNode(Node ovsdbNode) {
143         Preconditions.checkNotNull(configurationService);
144
145         try {
146             createIntegrationBridge(ovsdbNode);
147         } catch (Exception e) {
148             LOG.error("Error creating Integration Bridge on {}", ovsdbNode, e);
149             return;
150         }
151
152         try {
153             if (configurationService.isL3ForwardingEnabled()) {
154                 createExternalBridge(ovsdbNode);
155             }
156         } catch (Exception e) {
157             LOG.error("Error creating External Bridge on {}", ovsdbNode, e);
158             return;
159         }
160         // this node is an ovsdb node so it doesn't have a bridge
161         // so either look up the bridges or just wait for the bridge update to come in
162         // and add the flows there.
163         //networkingProviderManager.getProvider(node).initializeFlowRules(node);
164     }
165
166     /**
167      * Check if the full network setup is available. If not, create it.
168      */
169     @Override
170     public boolean createLocalNetwork (Node bridgeNode, NeutronNetwork network) {
171         boolean isCreated = false;
172         Node ovsdbNode = southbound.readOvsdbNode(bridgeNode);
173         if (ovsdbNode == null) {
174             //this should never happen
175             LOG.error("createLocalNetwork could not find ovsdbNode from bridge node " + bridgeNode);
176             return false;
177         }
178         if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
179             if (!isNodeVlanReady(bridgeNode, ovsdbNode, network)) {
180                 try {
181                     isCreated = createBridges(bridgeNode, ovsdbNode, network);
182                 } catch (Exception e) {
183                     LOG.error("Error creating internal vlan net network " + bridgeNode, e);
184                 }
185             } else {
186                 isCreated = true;
187             }
188         } else if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) ||
189                    network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE)) {
190             if (!isNodeTunnelReady(bridgeNode, ovsdbNode)) {
191                 try {
192                     isCreated = createBridges(bridgeNode, ovsdbNode, network);
193                 } catch (Exception e) {
194                     LOG.error("Error creating internal vxlan/gre net network " + bridgeNode, e);
195                 }
196             } else {
197                 isCreated = true;
198             }
199         }
200         return isCreated;
201     }
202
203
204
205     @Override
206     public String getExternalInterfaceName (Node node, String extNetwork) {
207         String phyIf = null;
208         String providerMaps = southbound.getOtherConfig(node, OvsdbTables.OPENVSWITCH,
209                 configurationService.getProviderMappingsKey());
210         if (providerMaps != null) {
211             for (String map : providerMaps.split(",")) {
212                 String[] pair = map.split(":");
213                 if (pair[0].equals(extNetwork)) {
214                     phyIf = pair[1];
215                     break;
216                 }
217             }
218         }
219         if (phyIf == null) {
220             LOG.error("External interface not found for Node: {}, Network {}",
221                     node, extNetwork);
222         }
223         else {
224             LOG.info("External interface found for Node: {}, Network {} is {}",node,extNetwork,phyIf);
225         }
226         return phyIf;
227     }
228
229
230
231     @Override
232     public String getPhysicalInterfaceName (Node node, String physicalNetwork) {
233         String phyIf = null;
234         String providerMaps = southbound.getOtherConfig(node, OvsdbTables.OPENVSWITCH,
235                 configurationService.getProviderMappingsKey());
236         if (providerMaps == null) {
237             providerMaps = configurationService.getDefaultProviderMapping();
238         }
239
240         if (providerMaps != null) {
241             for (String map : providerMaps.split(",")) {
242                 String[] pair = map.split(":");
243                 if (pair[0].equals(physicalNetwork)) {
244                     phyIf = pair[1];
245                     break;
246                 }
247             }
248         }
249
250         if (phyIf == null) {
251             LOG.error("Physical interface not found for Node: {}, Network {}",
252                     node, physicalNetwork);
253         }
254
255         return phyIf;
256     }
257
258     @Override
259     public List<String> getAllPhysicalInterfaceNames(Node node) {
260         List<String> phyIfName = Lists.newArrayList();
261         String providerMaps = southbound.getOtherConfig(node, OvsdbTables.OPENVSWITCH,
262                 configurationService.getProviderMappingsKey());
263         if (providerMaps == null) {
264             providerMaps = configurationService.getDefaultProviderMapping();
265         }
266
267         if (providerMaps != null) {
268             for (String map : providerMaps.split(",")) {
269                 String[] pair = map.split(":");
270                 phyIfName.add(pair[1]);
271             }
272         }
273
274         return phyIfName;
275     }
276
277     /**
278      * Returns true if a patch port exists between the Integration Bridge and Network Bridge
279      */
280     private boolean isNetworkPatchCreated(Node intBridge, Node netBridge) {
281         Preconditions.checkNotNull(configurationService);
282
283         boolean isPatchCreated = false;
284
285         String portName = configurationService.getPatchPortName(new ImmutablePair<>(intBridge, netBridge));
286         if (isPortOnBridge(intBridge, portName)) {
287             portName = configurationService.getPatchPortName(new ImmutablePair<>(netBridge, intBridge));
288             if (isPortOnBridge(netBridge, portName)) {
289                 isPatchCreated = true;
290             }
291         }
292
293         return isPatchCreated;
294     }
295
296     /**
297      * Creates the Integration Bridge
298      */
299     private boolean createIntegrationBridge(Node ovsdbNode) {
300         Preconditions.checkNotNull(configurationService);
301
302         if (!addBridge(ovsdbNode, configurationService.getIntegrationBridgeName())) {
303             LOG.debug("Integration Bridge Creation failed");
304             return false;
305         }
306         return true;
307     }
308
309     private boolean createExternalBridge(Node ovsdbNode) {
310         Preconditions.checkNotNull(configurationService);
311
312         if (!addBridge(ovsdbNode, configurationService.getExternalBridgeName())) {
313             LOG.debug("External Bridge Creation failed");
314             return false;
315         }
316         return true;
317     }
318
319     /**
320      * Create and configure bridges for all network types and OpenFlow versions.
321      *
322        OF 1.0 vlan:
323        Bridge br-int
324             Port patch-net
325                 Interface patch-net
326                     type: patch
327                     options: {peer=patch-int}
328             Port br-int
329                 Interface br-int
330                     type: internal
331        Bridge br-net
332             Port "eth1"
333                 Interface "eth1"
334             Port patch-int
335                 Interface patch-int
336                     type: patch
337                     options: {peer=patch-net}
338             Port br-net
339                 Interface br-net
340                     type: internal
341
342        OF 1.0 tunnel:
343        Bridge br-int
344             Port patch-net
345                 Interface patch-net
346                     type: patch
347                     options: {peer=patch-int}
348             Port br-int
349                 Interface br-int
350                     type: internal
351        Bridge "br-net"
352             Port patch-int
353                 Interface patch-int
354                     type: patch
355                     options: {peer=patch-net}
356             Port br-net
357                 Interface br-net
358                     type: internal
359
360        OF 1.3 vlan:
361        Bridge br-int
362             Port "eth1"
363                 Interface "eth1"
364             Port br-int
365                 Interface br-int
366                     type: internal
367
368        OF 1.3 tunnel:
369        Bridge br-int
370             Port br-int
371                 Interface br-int
372                     type: internal
373      */
374     private boolean createBridges(Node bridgeNode, Node ovsdbNode, NeutronNetwork network) {
375         Preconditions.checkNotNull(configurationService);
376         Preconditions.checkNotNull(networkingProviderManager);
377
378         LOG.debug("createBridges: node: {}, network type: {}", bridgeNode, network.getProviderNetworkType());
379
380         final String brInt = configurationService.getIntegrationBridgeName();
381         if (! createIntegrationBridge(ovsdbNode)) {
382             LOG.debug("{} Bridge creation failed", brInt);
383             return false;
384         }
385
386         if (configurationService.isL3ForwardingEnabled()) {
387             final String brExt = configurationService.getExternalBridgeName();
388             if (! createExternalBridge(ovsdbNode)) {
389                 LOG.error("{} Bridge creation failed", brExt);
390                 return false;
391             }
392
393             //get two patch port names
394             final String portNameInt = configurationService.getPatchPortName(new ImmutablePair<>(brInt, brExt));
395             final String portNameExt = configurationService.getPatchPortName(new ImmutablePair<>(brExt, brInt));
396             Preconditions.checkNotNull(portNameInt);
397             Preconditions.checkNotNull(portNameExt);
398
399             if (!addPatchPort(bridgeNode, brInt, portNameInt, portNameExt)) {
400                 LOG.error("Add Port {} to Bridge {} failed", portNameInt, brInt);
401                 return false;
402             }
403             Node extBridgeNode = southbound.readBridgeNode(ovsdbNode, brExt);
404             Preconditions.checkNotNull(extBridgeNode);
405             if (!addPatchPort(extBridgeNode, brExt, portNameExt, portNameInt)) {
406                 LOG.error("Add Port {} to Bridge {} failed", portNameExt, brExt);
407                 return false;
408             }
409             String extNetName = getExternalInterfaceName(extBridgeNode, brExt);
410             if ( extNetName != null) {
411                 if (!addPortToBridge(extBridgeNode, brExt, extNetName)) {
412                     LOG.error("Add External Port {} to Bridge {} failed", extNetName, brExt);
413                     return false;
414                 }
415             LOG.info("Add External Port {} to Ext Bridge {} success", extNetName, brExt);
416             }
417         }
418         /* For vlan network types add physical port to br-int. */
419         if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
420             String phyNetName = this.getPhysicalInterfaceName(bridgeNode, network.getProviderPhysicalNetwork());
421             if (!addPortToBridge(bridgeNode, brInt, phyNetName)) {
422                 LOG.debug("Add Port {} to Bridge {} failed", phyNetName, brInt);
423                 return false;
424             }
425         }
426
427         LOG.info("createBridges: node: {}, status: success", bridgeNode);
428         return true;
429     }
430
431     /**
432      * Add a Port to a Bridge
433      */
434     private boolean addPortToBridge (Node node, String bridgeName, String portName) {
435         boolean rv = true;
436
437         if (southbound.extractTerminationPointAugmentation(node, portName) == null) {
438             rv = southbound.addTerminationPoint(node, bridgeName, portName, null);
439
440             if (rv) {
441                 LOG.info("addPortToBridge: node: {}, bridge: {}, portname: {} status: success",
442                         node.getNodeId().getValue(), bridgeName, portName);
443             } else {
444                 LOG.error("addPortToBridge: node: {}, bridge: {}, portname: {} status: FAILED",
445                         node.getNodeId().getValue(), bridgeName, portName);
446             }
447         } else {
448             LOG.trace("addPortToBridge: node: {}, bridge: {}, portname: {} status: not_needed",
449                     node.getNodeId().getValue(), bridgeName, portName);
450         }
451
452         return rv;
453     }
454
455     /**
456      * Add a Patch Port to a Bridge
457      */
458     private boolean addPatchPort (Node node, String bridgeName, String portName, String peerPortName) {
459         boolean rv = true;
460
461         if (southbound.extractTerminationPointAugmentation(node, portName) == null) {
462             rv = southbound.addPatchTerminationPoint(node, bridgeName, portName, peerPortName);
463
464             if (rv) {
465                 LOG.info("addPatchPort: node: {}, bridge: {}, portname: {} peer: {} status: success",
466                         node.getNodeId().getValue(), bridgeName, portName, peerPortName);
467             } else {
468                 LOG.error("addPatchPort: node: {}, bridge: {}, portname: {} peer: {} status: FAILED",
469                         node.getNodeId().getValue(), bridgeName, portName, peerPortName);
470             }
471         } else {
472             LOG.trace("addPatchPort: node: {}, bridge: {}, portname: {} peer: {} status: not_needed",
473                     node.getNodeId().getValue(), bridgeName, portName, peerPortName);
474         }
475
476         return rv;
477     }
478
479     /**
480      * Add Bridge to a Node
481      */
482     private boolean addBridge(Node ovsdbNode, String bridgeName) {
483         boolean rv = true;
484         if ((!southbound.isBridgeOnOvsdbNode(ovsdbNode, bridgeName)) ||
485                 (southbound.getBridgeFromConfig(ovsdbNode, bridgeName) == null)) {
486             rv = southbound.addBridge(ovsdbNode, bridgeName, getControllersFromOvsdbNode(ovsdbNode));
487         }
488         return rv;
489     }
490
491     private String getControllerIPAddress() {
492         String addressString = ConfigProperties.getProperty(this.getClass(), "ovsdb.controller.address");
493         if (addressString != null) {
494             try {
495                 if (InetAddress.getByName(addressString) != null) {
496                     return addressString;
497                 }
498             } catch (UnknownHostException e) {
499                 LOG.error("Host {} is invalid", addressString);
500             }
501         }
502
503         addressString = ConfigProperties.getProperty(this.getClass(), "of.address");
504         if (addressString != null) {
505             try {
506                 if (InetAddress.getByName(addressString) != null) {
507                     return addressString;
508                 }
509             } catch (UnknownHostException e) {
510                 LOG.error("Host {} is invalid", addressString);
511             }
512         }
513
514         return null;
515     }
516
517     private short getControllerOFPort() {
518         short openFlowPort = Constants.OPENFLOW_PORT;
519         String portString = ConfigProperties.getProperty(this.getClass(), "of.listenPort");
520         if (portString != null) {
521             try {
522                 openFlowPort = Short.parseShort(portString);
523             } catch (NumberFormatException e) {
524                 LOG.warn("Invalid port:{}, use default({})", portString,
525                         openFlowPort);
526             }
527         }
528         return openFlowPort;
529     }
530
531     private List<String> getControllersFromOvsdbNode(Node node) {
532         List<String> controllersStr = new ArrayList<>();
533
534         String controllerIpStr = getControllerIPAddress();
535         if (controllerIpStr != null) {
536             // If codepath makes it here, the ip address to be used was explicitly provided.
537             // Being so, also fetch openflowPort provided via ConfigProperties.
538             controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL
539                     + ":" + controllerIpStr + ":" + getControllerOFPort());
540         } else {
541             // Check if ovsdb node has manager entries
542             OvsdbNodeAugmentation ovsdbNodeAugmentation = southbound.extractOvsdbNode(node);
543             if (ovsdbNodeAugmentation != null) {
544                 List<ManagerEntry> managerEntries = ovsdbNodeAugmentation.getManagerEntry();
545                 if (managerEntries != null && !managerEntries.isEmpty()) {
546                     for (ManagerEntry managerEntry : managerEntries) {
547                         if (managerEntry == null || managerEntry.getTarget() == null) {
548                             continue;
549                         }
550                         String[] tokens = managerEntry.getTarget().getValue().split(":");
551                         if (tokens.length == 3 && tokens[0].equalsIgnoreCase("tcp")) {
552                             controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL
553                                     + ":" + tokens[1] + ":" + getControllerOFPort());
554                         } else if (tokens[0].equalsIgnoreCase("ptcp")) {
555                             ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo();
556                             if (connectionInfo != null && connectionInfo.getLocalIp() != null) {
557                                 controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue());
558                                 controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL
559                                         + ":" + controllerIpStr + ":" + Constants.OPENFLOW_PORT);
560                             } else {
561                                 LOG.warn("Ovsdb Node does not contain connection info: {}", node);
562                             }
563                         } else {
564                             LOG.trace("Skipping manager entry {} for node {}",
565                                     managerEntry.getTarget(), node.getNodeId().getValue());
566                         }
567                     }
568                 } else {
569                     LOG.warn("Ovsdb Node does not contain manager entries : {}", node);
570                 }
571             }
572         }
573
574         if (controllersStr.isEmpty()) {
575             // Neither user provided ip nor ovsdb node has manager entries. Lets use local machine ip address.
576             LOG.debug("Use local machine ip address as a OpenFlow Controller ip address");
577             controllerIpStr = getLocalControllerHostIpAddress();
578             if (controllerIpStr != null) {
579                 controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL
580                         + ":" + controllerIpStr + ":" + Constants.OPENFLOW_PORT);
581             }
582         }
583
584         if (controllersStr.isEmpty()) {
585             LOG.warn("Failed to determine OpenFlow controller ip address");
586         } else if (LOG.isDebugEnabled()) {
587             controllerIpStr = "";
588             for (String currControllerIpStr : controllersStr) {
589                 controllerIpStr += " " + currControllerIpStr;
590             }
591             LOG.debug("Found {} OpenFlow Controller(s) :{}", controllersStr.size(), controllerIpStr);
592         }
593
594         return controllersStr;
595     }
596
597     private String getLocalControllerHostIpAddress() {
598         String ipaddress = null;
599         try{
600             for (Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();ifaces.hasMoreElements();){
601                 NetworkInterface iface = ifaces.nextElement();
602
603                 for (Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
604                     InetAddress inetAddr = inetAddrs.nextElement();
605                     if (!inetAddr.isLoopbackAddress() && inetAddr.isSiteLocalAddress()) {
606                         ipaddress = inetAddr.getHostAddress();
607                         break;
608                     }
609                 }
610             }
611         }catch (Exception e){
612             LOG.warn("Exception while fetching local host ip address ", e);
613         }
614         return ipaddress;
615     }
616
617     @Override
618     public void setDependencies(ServiceReference serviceReference) {
619         configurationService =
620                 (ConfigurationService) ServiceHelper.getGlobalInstance(ConfigurationService.class, this);
621         networkingProviderManager =
622                 (NetworkingProviderManager) ServiceHelper.getGlobalInstance(NetworkingProviderManager.class, this);
623         southbound =
624                 (Southbound) ServiceHelper.getGlobalInstance(Southbound.class, this);
625     }
626
627     @Override
628     public void setDependencies(Object impl) {
629     }
630 }