private void buildServiceInstance(ModelController controller, String serviceUuid) {
ContrailManager manager = controller.getManager();
ApiConnector api = controller.getApiAccessor();
_serviceUuid = serviceUuid;
ServiceInstance siObj;
try {
siObj = (ServiceInstance) api.findById(ServiceInstance.class, serviceUuid);
} catch (IOException ex) {
s_logger.warn("service-instance read", ex);
throw new CloudRuntimeException("Unable to read service-instance object", ex);
}
ServiceInstanceModel siModel;
if (siObj == null) {
siModel = new ServiceInstanceModel(serviceUuid);
siModel.build(controller, siObj);
manager.getDatabase().getServiceInstances().add(siModel);
} else {
String fqn = StringUtils.join(siObj.getQualifiedName(), ':');
siModel = manager.getDatabase().lookupServiceInstance(fqn);
if (siModel == null) {
if (siObj == null) {
siModel = new ServiceInstanceModel(serviceUuid);
siModel.build(controller, siObj);