+ logger.debug("Invalid IP Address when trying to remove host", e);
+ return new Status(StatusCode.BADREQUEST, "Invalid IP Address when trying to remove host");
+ }
+ }
+
+ @Override
+ public Status removeStaticHostUsingIPAndMac(String networkAddress, String macAddress) {
+ try {
+ if ((keyScheme != null) && (keyScheme.equals(HostIdFactory.DEFAULT_IP_KEY_SCHEME))) {
+ return new Status(StatusCode.NOTALLOWED, "Host DB Key scheme used is not IP only scheme.");
+ }
+ InetAddress address = InetAddress.getByName(networkAddress);
+ DataLinkAddress mac = new EthernetAddress(HexEncode.bytesFromHexString(macAddress));
+ return removeStaticHostReq(address, mac);
+ } catch (UnknownHostException e) {
+ logger.debug("Invalid IP Address when trying to remove host", e);
+ return new Status(StatusCode.BADREQUEST, "Invalid IP Address when trying to remove host");
+ } catch (ConstructionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return new Status(StatusCode.BADREQUEST, "Invalid Input parameters have been passed.");
+ }
+ }
+
+ private InetAddress decodeIPFromId(IHostId id) {
+ if ((keyScheme != null) && (keyScheme.equals(HostIdFactory.DEFAULT_IP_KEY_SCHEME))) {
+ IPHostId ipId = (IPHostId) id;
+ return (ipId.getIpAddress());
+ } else if ((keyScheme != null) && (keyScheme.equals(HostIdFactory.IP_MAC_KEY_SCHEME))) {
+ IPMacHostId ipMacId = (IPMacHostId) id;
+ return (ipMacId.getIpAddress());
+ }
+ return null;
+ }
+
+ private DataLinkAddress decodeMacFromId(IHostId id) {
+ if ((keyScheme != null) && (!keyScheme.equals(HostIdFactory.DEFAULT_IP_KEY_SCHEME))) {
+ IPMacHostId ipMacId = (IPMacHostId) id;
+ return (ipMacId.getMacAddr());