### Question:
SouthboundUtil { public static String getControllerTarget(Node ovsdbNode) { String target = null; String ipAddr = null; OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.augmentation(OvsdbNodeAugmentation.class); ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); LOG.info("connectionInfo: {}", connectionInfo); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { ipAddr = connectionInfo.getLocalIp().stringValue(); } if (ipAddr == null) { ipAddr = getLocalControllerHostIpAddress(); } if (ipAddr != null) { target = SouthboundConstants.OPENFLOW_CONNECTION_PROTOCOL + ":" + ipAddr + ":" + SouthboundConstants.DEFAULT_OPENFLOW_PORT; } return target; } private  SouthboundUtil(); static Optional<OvsdbNodeAugmentation> getManagingNode(DataBroker db, OvsdbBridgeAttributes mn); static Optional<D> readNode(ReadWriteTransaction transaction,
        InstanceIdentifier<D> connectionIid); static Optional<D> readNode(ReadTransaction transaction,
                                                              InstanceIdentifier<D> connectionIid); static String getControllerTarget(Node ovsdbNode); static String connectionInfoToString(final ConnectionInfo connectionInfo); static void schemaMismatchLog(String column, String table, SchemaVersionMismatchException ex); static PortExternalIds createExternalIdsForPort(String key, String value); static InterfaceExternalIds createExternalIdsForInterface(String key, String value); static InterfaceExternalIds interfaceCreatedByOpenDaylight(); static PortExternalIds portCreatedByOpenDaylight(); @SuppressWarnings("checkstyle:IllegalCatch") static String getOvsdbNodeId(InstanceIdentifier<Node> nodeIid); static String getBridgeNameFromOvsdbNodeId(InstanceIdentifier<Node> nodeIid);  }### Answer:
@Test public void testGetControllerTarget() throws Exception { Node ovsdbNode = mock(Node.class); OvsdbNodeAugmentation ovsdbNodeAugmentation = mock(OvsdbNodeAugmentation.class); when(ovsdbNode.augmentation(OvsdbNodeAugmentation.class)).thenReturn(ovsdbNodeAugmentation); ConnectionInfo connectionInfo = mock(ConnectionInfo.class, Mockito.RETURNS_DEEP_STUBS); when(ovsdbNodeAugmentation.getConnectionInfo()).thenReturn(connectionInfo); IpAddress ipAddr = new IpAddress(new Ipv4Address("0.0.0.0")); when(connectionInfo.getLocalIp()).thenReturn(ipAddr); String testTarget = SouthboundConstants.OPENFLOW_CONNECTION_PROTOCOL + ":" + "0.0.0.0" + ":" + SouthboundConstants.DEFAULT_OPENFLOW_PORT; assertEquals("Incorrect controller IP", testTarget, SouthboundUtil.getControllerTarget(ovsdbNode)); verify(ovsdbNode).augmentation(OvsdbNodeAugmentation.class); verify(ovsdbNodeAugmentation).getConnectionInfo(); when(connectionInfo.getLocalIp()).thenReturn(null); PowerMockito.doReturn("127.0.0.1").when(SouthboundUtil.class, "getLocalControllerHostIpAddress"); testTarget = SouthboundConstants.OPENFLOW_CONNECTION_PROTOCOL + ":" + "127.0.0.1" + ":" + SouthboundConstants.DEFAULT_OPENFLOW_PORT; assertEquals("Incorrect Local controller host IP", testTarget, SouthboundUtil.getControllerTarget(ovsdbNode)); }