private void updateNetworkLabels(HostVO host) {
    // check if networkLabels need to be updated in details
    // we send only private and storage network label to the resource.
    String privateNetworkLabel =
        _networkMgr.getDefaultManagementTrafficLabel(
            host.getDataCenterId(), host.getHypervisorType());
    String storageNetworkLabel =
        _networkMgr.getDefaultStorageTrafficLabel(host.getDataCenterId(), host.getHypervisorType());

    String privateDevice = host.getDetail("private.network.device");
    String storageDevice = host.getDetail("storage.network.device1");

    boolean update = false;

    if (privateNetworkLabel != null && !privateNetworkLabel.equalsIgnoreCase(privateDevice)) {
      host.setDetail("private.network.device", privateNetworkLabel);
      update = true;
    }
    if (storageNetworkLabel != null && !storageNetworkLabel.equalsIgnoreCase(storageDevice)) {
      host.setDetail("storage.network.device1", storageNetworkLabel);
      update = true;
    }
    if (update) {
      _hostDao.saveDetails(host);
    }
  }
  @Override
  public Host addSspHost(AddSspCmd cmd) {
    SspClient client = new SspClient(cmd.getUrl(), cmd.getUsername(), cmd.getPassword());
    if (!client.login()) {
      throw new CloudRuntimeException("Ssp login failed.");
    }

    long zoneId = cmd.getZoneId();
    SspCredentialVO credential = _sspCredentialDao.findByZone(zoneId);
    if (credential == null) {
      if (cmd.getUsername() == null || cmd.getPassword() == null) {
        throw new InvalidParameterValueException("Initial credential required for zone: " + zoneId);
      }
      credential = new SspCredentialVO();
      credential.setZoneId(zoneId);
      credential.setUsername(cmd.getUsername());
      credential.setPassword(cmd.getPassword());
      _sspCredentialDao.persist(credential);
    } else {
      if (cmd.getUsername() != null || cmd.getPassword() != null) {
        s_logger.warn("Tenant credential already configured for zone:" + zoneId);
      }
    }

    String tenantUuid = _sspTenantDao.findUuidByZone(zoneId);
    if (tenantUuid == null) {
      if (cmd.getTenantUuid() == null) {
        throw new InvalidParameterValueException(
            "Initial tenant uuid required for zone: " + zoneId);
      }
      SspTenantVO tenant = new SspTenantVO();
      tenant.setZoneId(zoneId);
      tenant.setUuid(cmd.getTenantUuid());
      _sspTenantDao.persist(tenant);
    } else {
      if (cmd.getTenantUuid() != null) {
        s_logger.warn("Tenant uuid already configured for zone:" + zoneId);
      }
    }

    String normalizedUrl = null;
    String hostname = null;
    try {
      URL url = new URL(cmd.getUrl());
      normalizedUrl = url.toString();
      hostname = url.getHost();
    } catch (MalformedURLException e1) {
      throw new CloudRuntimeException("Invalid url " + cmd.getUrl());
    }

    List<HostVO> hosts = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.L2Networking, zoneId);
    for (HostVO host : hosts) {
      assert (credential != null);
      _hostDao.loadDetails(host);
      if ("v1Api".equals(host.getDetail("sspHost"))) {
        if (normalizedUrl.equals(host.getDetail("url"))) {
          s_logger.warn("Ssp host already registered " + normalizedUrl);
          return host;
        }
      }
    }
    // SspHost HostVO will be created per zone and url.
    HostVO host = new HostVO(UUID.randomUUID().toString());
    host.setDataCenterId(zoneId);
    host.setType(Host.Type.L2Networking);
    host.setPrivateIpAddress(hostname); // db schema not null. It may be a name, not IP address.
    //        host.setPrivateMacAddress(""); // db schema nullable
    //        host.setPrivateNetmask(""); // db schema nullable
    host.setVersion("1"); // strange db schema not null
    host.setName(cmd.getName());

    host.setDetails(new HashMap<String, String>());
    host.setDetail("sspHost", "v1Api");
    host.setDetail("url", normalizedUrl);
    return _hostDao.persist(host);
  }