ExporterUtil { protected static ObjectNode getDataPlaneLocatorObjectNode(DataPlaneLocator dataPlaneLocator) { if (dataPlaneLocator == null) { return null; } ObjectMapper mapper = new ObjectMapper(); ObjectNode locatorNode = null; if (dataPlaneLocator.getLocatorType() != null) { locatorNode = mapper.createObjectNode(); String type = dataPlaneLocator.getLocatorType().getImplementedInterface().getSimpleName().toLowerCase(); switch (type) { case FUNCTION: Function functionLocator = (Function) dataPlaneLocator.getLocatorType(); locatorNode.put(_FUNCTION_NAME, functionLocator.getFunctionName()); break; case IP: Ip ipLocator = (Ip) dataPlaneLocator.getLocatorType(); if (ipLocator.getIp() != null) { locatorNode.put(_IP, convertIpAddress(ipLocator.getIp())); if (ipLocator.getPort() != null) { locatorNode.put(_PORT, ipLocator.getPort().getValue()); } } break; case LISP: Lisp lispLocator = (Lisp) dataPlaneLocator.getLocatorType(); if (lispLocator.getEid() != null) locatorNode.put(_EID, convertIpAddress(lispLocator.getEid())); break; case MAC: Mac macLocator = (Mac) dataPlaneLocator.getLocatorType(); if (macLocator.getMac() != null) locatorNode.put(_MAC, macLocator.getMac().getValue()); locatorNode.put(_VLAN_ID, macLocator.getVlanId()); } } if (dataPlaneLocator.getTransport() != null) { if (locatorNode == null) { locatorNode = mapper.createObjectNode(); } locatorNode.put(_TRANSPORT, getDataPlaneLocatorTransport(dataPlaneLocator)); } return locatorNode; }  static String convertIpAddress(IpAddress ip); static final String _TRANSPORT; static final String _EID; static final String _IP; static final String _PORT; static final String _MAC; static final String _VLAN_ID; static final String _FUNCTION_NAME; static final String _VXLAN_GPE; static final String _GRE; static final String _OTHER; static final String _SF_DPL_NAME; static final String _SFF_DPL_NAME; static final String FUNCTION; static final String IP; static final String LISP; static final String MAC; static final String VXLAN_GPE; static final String GRE; static final String OTHER; static final String SERVICE_LOCATOR_PREFIX; }
@Test public void testDataPlaneLocatorObjectNodeNullDpl() { assertNull("Must be null", ExporterUtil.getDataPlaneLocatorObjectNode(null)); }
@Test public void testDataPlaneLocatorTransportNullDpl() { assertNull("Must be null", ExporterUtil.getDataPlaneLocatorObjectNode(null)); }