diff options
Diffstat (limited to 'ncomp-docker-adaptor/src')
22 files changed, 869 insertions, 555 deletions
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/docker/adaptor/tools/Generator.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/docker/adaptor/tools/Generator.java index 09f3f3f..2de12d8 100644 --- a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/docker/adaptor/tools/Generator.java +++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/docker/adaptor/tools/Generator.java @@ -45,12 +45,13 @@ public class Generator { String dir = p.getNsURI().replaceAll(p.getNsPrefix() + '$', "") + "servers." + p.getNsPrefix();
dir = "src/main/sirius-gen/" + dir.replace('.', '/');
ControllerModel m = ControllermodelFactory.eINSTANCE.createControllerModel();
- m.setTemplateDirectory("../../dcae-org.openecomp.ncomp.sirius.manager/ncomp-sirius-manager-generator/src/main/templates");
+ m.setTemplateDirectory("../../ncomp.sirius.manager/ncomp-sirius-manager-generator/src/main/templates");
m.setPrefix("Docker");
m.setPluginName(p.getNsURI());
m.setName("Docker");
m.setTitle("Docker");
- ControllerGenerator g = new ControllerGenerator(o, m);
+ ControllerGenerator g = new ControllerGenerator(o, m); + g.setVersion("ONAP-R2");
EObject h = DockerFactory.eINSTANCE.createDockerHost();
g.addApi("host", h, m, false, true);
g.setEnableIRequestHandler(false);
diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerAbstractClient.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerAbstractClient.java index 30a5777..2fc41a8 100644 --- a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerAbstractClient.java +++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerAbstractClient.java @@ -74,8 +74,8 @@ public abstract class DockerAbstractClient { EOperation op = EUtils.name2operation(o.eClass(), opName); if (op == null) throw new RuntimeException("no such operation: " + opName + " on " + o); - JSONObject res = operationPath2(path, opName, timeout, ManagementServer.params2json(op, params)); - return ManagementServer.json2response(op, res); + JSONObject res = operationPath2(path, opName, timeout, ManagementServer.params2json(op, params, "UNKNOWN")); + return ManagementServer.json2response(op, res, "UNKNOWN"); } public JSONObject operation(String resourcePath, String opName, Long timeout, JSONObject json) { @@ -96,14 +96,14 @@ public abstract class DockerAbstractClient { throw new RuntimeException("Unknown operation " + opName + " on Eclass " + c.getName()); } JSONObject res; - JSONObject json1 = ManagementServer.params2json(op, params); + JSONObject json1 = ManagementServer.params2json(op, params, "UNKNOWN"); if (language != null && language.equals("restconf")) { res = operationOdl("/restconf/operations/" + namespace + ":" + opName,timeout,json1); } else { res = operationPath2(resourcePath, op.getName(), timeout, json1 ); } - return ManagementServer.json2response(op, res); + return ManagementServer.json2response(op, res, "UNKNOWN"); } // abstract public void sendToDataRouter(String feedname, String fileId, diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerHostProvider.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerHostProvider.java index d3888dc..8ea1ba9 100644 --- a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerHostProvider.java +++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/DockerDockerHostProvider.java @@ -40,7 +40,6 @@ import org.openecomp.ncomp.sirius.manager.ISiriusServer; import org.openecomp.ncomp.sirius.manager.ManagementServer; import org.openecomp.ncomp.sirius.manager.ManagementServerUtils; -import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONObject; @@ -63,6 +62,7 @@ import org.openecomp.ncomp.docker.DockerImage; import org.openecomp.ncomp.docker.DockerNetwork; import org.openecomp.ncomp.docker.DockerPackage; + import org.eclipse.emf.common.util.EList; class DockerDockerHostProvider extends BasicAdaptorProvider { @@ -102,11 +102,6 @@ class DockerDockerHostProvider extends BasicAdaptorProvider { CREATE, START, STOP, RESTART, PAUSE, UNPAUSE, KILL, DESTORY } - private JSONObject encodeAuth(String json) { - String auth = Base64.encodeBase64String(json.getBytes()); - return new JSONObject(auth); - } - public DockerDockerHostProvider(ISiriusServer controller, DockerHost o) { super(controller, o); this.o = o; @@ -405,9 +400,9 @@ class DockerDockerHostProvider extends BasicAdaptorProvider { // EList<DockerProcess> cp = container.getProcesses(); // cp = (EList<DockerProcess>)Arrays.asList(dp); - System.err.println("XXXX " - + ManagementServer.ecore2json(container, 100, null, true) - .toString(2)); +// System.err.println("XXXX " +// + ManagementServer.ecore2json(container, 100, null, true) +// .toString(2)); o.getContainers().add(container); } } @@ -423,7 +418,7 @@ class DockerDockerHostProvider extends BasicAdaptorProvider { fixNull(j); rename(j, "created", "dockerCreated"); if (j.has("labels")) j.remove("labels"); - System.err.println("XXXX " + j.toString()); +// System.err.println("XXXX " + j.toString()); DockerImage image = (DockerImage) controller.getServer() .json2ecore(DockerPackage.eINSTANCE.getDockerImage(), j); // System.err.println("XXXX " + ManagementServer.ecore2json(image, @@ -460,7 +455,7 @@ class DockerDockerHostProvider extends BasicAdaptorProvider { JSONObject netwks = j.getJSONObject("networks"); for(String net : JSONObject.getNames(netwks)) { JSONObject intf = netwks.getJSONObject(net); - System.err.println(net + " <- " + intf.toString(4)); +// System.err.println(net + " <- " + intf.toString(4)); ContainerNetworkStats cnet = DockerFactory.eINSTANCE.createContainerNetworkStats(); cnet.setIntf(net); cnet.setRx_bytes(intf.getInt("rx_bytes")); @@ -484,7 +479,10 @@ class DockerDockerHostProvider extends BasicAdaptorProvider { memusg.setUsage(mem.getInt("usage")); memusg.setMax_usage(mem.getInt("max_usage")); memusg.setLimit(mem.getInt("limit")); - memusg.setFailcnt(mem.getInt("failcnt")); + try { + memusg.setFailcnt(mem.getInt("failcnt")); + } catch (Exception e) { + } /* * memory stats @@ -551,6 +549,7 @@ class DockerDockerHostProvider extends BasicAdaptorProvider { cstats.setCpu(ccpustats); c.setStats(cstats); + controller.getServer().save(); } } @@ -616,7 +615,7 @@ class DockerDockerHostProvider extends BasicAdaptorProvider { // System.err.println("XXXX " + v.getClass().getName()); if (v.getClass().getName().equals("org.json.JSONObject$Null")) { j.put(k, new JSONArray()); - System.err.println("XXXX change null to empty array " + k); +// System.err.println("XXXX change null to empty array " + k); } } } @@ -906,7 +905,7 @@ class DockerDockerHostProvider extends BasicAdaptorProvider { // 404 - no such container // 500 - server err } - + private List<String> getImageNameElements(String image) { List<String> a = new ArrayList<>(); diff --git a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestPolling.java b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestPolling.java index 450a41f..43f3910 100644 --- a/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestPolling.java +++ b/ncomp-docker-adaptor/src/main/java/org/openecomp/ncomp/servers/docker/TestPolling.java @@ -24,11 +24,6 @@ package org.openecomp.ncomp.servers.docker; import org.openecomp.ncomp.sirius.manager.ISiriusServer; import org.openecomp.ncomp.sirius.manager.ManagementServer; -/* - * the polled docker-engine is defined in docker.properties - * dockerHost.endpoint=https://host.domaon:port - * - */ public class TestPolling implements ISiriusServer { public static void main(String[] args) { diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/DockerHost.yaml b/ncomp-docker-adaptor/src/main/sirius-gen/DockerHost.yaml index b86e0ef..e2add00 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/DockerHost.yaml +++ b/ncomp-docker-adaptor/src/main/sirius-gen/DockerHost.yaml @@ -1,168 +1,129 @@ operations: - poll: {} - startContainer: {} - stopContainer: {} - restartContainer: {} - pauseContainer: {} - unpauseContainer: {} - removeContainer: {} - inspectContainer: {} - killContainer: {} - dockerRun: {} - dockerRunWithName: {} - dockerRunWithOptions: {} - containerStats: {} - containerProcesses: {} - pullImage: {} - REMOTE_poll: - decription: Remote call poll - REMOTE_startContainer: - decription: Remote call startContainer - REMOTE_stopContainer: - decription: Remote call stopContainer - REMOTE_restartContainer: - decription: Remote call restartContainer - REMOTE_pauseContainer: - decription: Remote call pauseContainer - REMOTE_unpauseContainer: - decription: Remote call unpauseContainer - REMOTE_removeContainer: - decription: Remote call removeContainer - REMOTE_inspectContainer: - decription: Remote call inspectContainer - REMOTE_killContainer: - decription: Remote call killContainer - REMOTE_dockerRun: - decription: Remote call dockerRun - REMOTE_dockerRunWithName: - decription: Remote call dockerRunWithName - REMOTE_dockerRunWithOptions: - decription: Remote call dockerRunWithOptions - REMOTE_containerStats: - decription: Remote call containerStats - REMOTE_containerProcesses: - decription: Remote call containerProcesses - REMOTE_pullImage: - decription: Remote call pullImage + DockerHost@poll: {} + DockerHost@startContainer: {} + DockerHost@stopContainer: {} + DockerHost@restartContainer: {} + DockerHost@pauseContainer: {} + DockerHost@unpauseContainer: {} + DockerHost@removeContainer: {} + DockerHost@inspectContainer: {} + DockerHost@killContainer: {} + DockerHost@dockerRun: {} + DockerHost@dockerRunWithName: {} + DockerHost@dockerRunWithOptions: {} + DockerHost@containerStats: {} + DockerHost@containerProcesses: {} messages: dummy: {} - poll: - errorCode: poll-FAILED-5001W + REQUEST-FAILED-poll: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - startContainer: - errorCode: startContainer-FAILED-5001W + REQUEST-FAILED-startContainer: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - stopContainer: - errorCode: stopContainer-FAILED-5001W + REQUEST-FAILED-stopContainer: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - restartContainer: - errorCode: restartContainer-FAILED-5001W + REQUEST-FAILED-restartContainer: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - pauseContainer: - errorCode: pauseContainer-FAILED-5001W + REQUEST-FAILED-pauseContainer: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - unpauseContainer: - errorCode: unpauseContainer-FAILED-5001W + REQUEST-FAILED-unpauseContainer: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - removeContainer: - errorCode: removeContainer-FAILED-5001W + REQUEST-FAILED-removeContainer: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - inspectContainer: - errorCode: inspectContainer-FAILED-5001W + REQUEST-FAILED-inspectContainer: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - killContainer: - errorCode: killContainer-FAILED-5001W + REQUEST-FAILED-killContainer: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - dockerRun: - errorCode: dockerRun-FAILED-5001W + REQUEST-FAILED-dockerRun: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - dockerRunWithName: - errorCode: dockerRunWithName-FAILED-5001W + REQUEST-FAILED-dockerRunWithName: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - dockerRunWithOptions: - errorCode: dockerRunWithOptions-FAILED-5001W + REQUEST-FAILED-dockerRunWithOptions: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - containerStats: - errorCode: containerStats-FAILED-5001W + REQUEST-FAILED-containerStats: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - containerProcesses: - errorCode: containerProcesses-FAILED-5001W + REQUEST-FAILED-containerProcesses: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - pullImage: - errorCode: pullImage-FAILED-5001W - messageFormat: '{0}' - description: Operation Failed with Exception - REMOTE_poll: - errorCode: REMOTE-poll-FAILED-5001W - messageFormat: '{0}' - description: Remote Operation Failed with Exception - REMOTE_startContainer: - errorCode: REMOTE-startContainer-FAILED-5001W + REMOTE-CALL-FAILED-poll: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_stopContainer: - errorCode: REMOTE-stopContainer-FAILED-5001W + REMOTE-CALL-FAILED-startContainer: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_restartContainer: - errorCode: REMOTE-restartContainer-FAILED-5001W + REMOTE-CALL-FAILED-stopContainer: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_pauseContainer: - errorCode: REMOTE-pauseContainer-FAILED-5001W + REMOTE-CALL-FAILED-restartContainer: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_unpauseContainer: - errorCode: REMOTE-unpauseContainer-FAILED-5001W + REMOTE-CALL-FAILED-pauseContainer: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_removeContainer: - errorCode: REMOTE-removeContainer-FAILED-5001W + REMOTE-CALL-FAILED-unpauseContainer: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_inspectContainer: - errorCode: REMOTE-inspectContainer-FAILED-5001W + REMOTE-CALL-FAILED-removeContainer: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_killContainer: - errorCode: REMOTE-killContainer-FAILED-5001W + REMOTE-CALL-FAILED-inspectContainer: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_dockerRun: - errorCode: REMOTE-dockerRun-FAILED-5001W + REMOTE-CALL-FAILED-killContainer: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_dockerRunWithName: - errorCode: REMOTE-dockerRunWithName-FAILED-5001W + REMOTE-CALL-FAILED-dockerRun: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_dockerRunWithOptions: - errorCode: REMOTE-dockerRunWithOptions-FAILED-5001W + REMOTE-CALL-FAILED-dockerRunWithName: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_containerStats: - errorCode: REMOTE-containerStats-FAILED-5001W + REMOTE-CALL-FAILED-dockerRunWithOptions: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_containerProcesses: - errorCode: REMOTE-containerProcesses-FAILED-5001W + REMOTE-CALL-FAILED-containerStats: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_pullImage: - errorCode: REMOTE-pullImage-FAILED-5001W + REMOTE-CALL-FAILED-containerProcesses: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/GuiClientApi.yaml b/ncomp-docker-adaptor/src/main/sirius-gen/GuiClientApi.yaml index bf3d69d..1489339 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/GuiClientApi.yaml +++ b/ncomp-docker-adaptor/src/main/sirius-gen/GuiClientApi.yaml @@ -1,69 +1,57 @@ operations: - getTree: {} - getObject: {} - getTimeSerie: {} - getTable: {} - getHtml: {} - getGraph: {} - REMOTE_getTree: - decription: Remote call getTree - REMOTE_getObject: - decription: Remote call getObject - REMOTE_getTimeSerie: - decription: Remote call getTimeSerie - REMOTE_getTable: - decription: Remote call getTable - REMOTE_getHtml: - decription: Remote call getHtml - REMOTE_getGraph: - decription: Remote call getGraph + GuiClientApi@getTree: {} + GuiClientApi@getObject: {} + GuiClientApi@getTimeSerie: {} + GuiClientApi@getTable: {} + GuiClientApi@getHtml: {} + GuiClientApi@getGraph: {} messages: dummy: {} - getTree: - errorCode: getTree-FAILED-5001W + REQUEST-FAILED-getTree: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - getObject: - errorCode: getObject-FAILED-5001W + REQUEST-FAILED-getObject: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - getTimeSerie: - errorCode: getTimeSerie-FAILED-5001W + REQUEST-FAILED-getTimeSerie: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - getTable: - errorCode: getTable-FAILED-5001W + REQUEST-FAILED-getTable: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - getHtml: - errorCode: getHtml-FAILED-5001W + REQUEST-FAILED-getHtml: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - getGraph: - errorCode: getGraph-FAILED-5001W + REQUEST-FAILED-getGraph: + errorCode: 4001W messageFormat: '{0}' description: Operation Failed with Exception - REMOTE_getTree: - errorCode: REMOTE-getTree-FAILED-5001W + REMOTE-CALL-FAILED-getTree: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_getObject: - errorCode: REMOTE-getObject-FAILED-5001W + REMOTE-CALL-FAILED-getObject: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_getTimeSerie: - errorCode: REMOTE-getTimeSerie-FAILED-5001W + REMOTE-CALL-FAILED-getTimeSerie: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_getTable: - errorCode: REMOTE-getTable-FAILED-5001W + REMOTE-CALL-FAILED-getTable: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_getHtml: - errorCode: REMOTE-getHtml-FAILED-5001W + REMOTE-CALL-FAILED-getHtml: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception - REMOTE_getGraph: - errorCode: REMOTE-getGraph-FAILED-5001W + REMOTE-CALL-FAILED-getGraph: + errorCode: 4001W messageFormat: '{0}' description: Remote Operation Failed with Exception diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptor.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptor.java index 2cdc121..2e235bb 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptor.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptor.java @@ -23,27 +23,48 @@ // Do not edit. No need to extend this class. package org.openecomp.ncomp.servers.docker; + + + + import java.io.InputStream; + import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISwaggerHandler; import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.manager.ISiriusProvider; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.manager.SwaggerUtils; import org.openecomp.ncomp.sirius.function.FunctionUtils; import org.openecomp.ncomp.component.ApiRequestStatus; import org.apache.log4j.Logger; + +import org.openecomp.ncomp.sirius.manager.logging.NcompLogger; +import org.openecomp.logger.StatusCodeEnum; +import org.openecomp.logger.EcompException; + import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; import org.json.JSONObject; + import java.util.Date; +import org.openecomp.ncomp.servers.docker.logging.DockerAdaptorOperationEnum; +import org.openecomp.ncomp.servers.docker.logging.DockerAdaptorMessageEnum; + + import org.openecomp.ncomp.docker.impl.DockerAdaptorImpl; -public class DockerDockerAdaptor extends DockerAdaptorImpl { +public class DockerDockerAdaptor extends DockerAdaptorImpl implements ISiriusProvider { public static final Logger logger = Logger.getLogger(DockerDockerAdaptor.class); - DockerDockerAdaptorProvider controller; + static final NcompLogger ecomplogger = NcompLogger.getNcompLogger(); + public DockerDockerAdaptorProvider controller; ISiriusServer server; public DockerDockerAdaptor(ISiriusServer server) { @@ -56,10 +77,12 @@ public class DockerDockerAdaptor extends DockerAdaptorImpl { + + public static void ecoreSetup() { DockerDockerAdaptorProvider.ecoreSetup(); } - public DockerDockerAdaptorProvider getSomfProvider() { + public DockerDockerAdaptorProvider getSiriusProvider() { return controller; } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorClient.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorClient.java index e629eb5..31de114 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorClient.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorClient.java @@ -28,10 +28,18 @@ import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient; import org.openecomp.ncomp.sirius.manager.GenericHttpClient; import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; +import org.openecomp.logger.StatusCodeEnum; +import org.openecomp.logger.EcompException; + import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; + import org.openecomp.ncomp.docker.impl.DockerAdaptorImpl; import org.openecomp.ncomp.docker.DockerPackage; +import org.openecomp.ncomp.servers.docker.logging.DockerAdaptorOperationEnum; +import org.openecomp.ncomp.servers.docker.logging.DockerAdaptorMessageEnum; @@ -41,23 +49,27 @@ import org.openecomp.ncomp.docker.DockerPackage; @SuppressWarnings("unchecked") public class DockerDockerAdaptorClient extends DockerAdaptorImpl { public static final Logger logger = Logger.getLogger(DockerDockerAdaptorClient.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); public AbstractClient client; public DockerDockerAdaptorClient(String file, String name) { DockerDockerAdaptor.ecoreSetup(); client = new GenericHttpClient(file,name); client.add("/resources", this); + client.setVersion("ONAP-R2"); } public DockerDockerAdaptorClient(String file, String name1, String name2) { HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2); client = client1.all; // requests should be forwarded to all. client.add("/resources", this); + client.setVersion("ONAP-R2"); } public DockerDockerAdaptorClient(AbstractClient c) { client = c; client.add("/resources", this); + client.setVersion("ONAP-R2"); } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorServer.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorServer.java index b4e83fa..5c7a17f 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorServer.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerAdaptorServer.java @@ -26,14 +26,16 @@ package org.openecomp.ncomp.servers.docker; import static org.openecomp.ncomp.utils.PropertyUtil.getPropertiesFromClasspath; import java.io.IOException; +import java.io.InputStream; import java.util.Properties; import java.util.TimeZone; import org.apache.log4j.Logger; import org.eclipse.emf.ecore.EFactory; - +import org.json.JSONObject; import org.openecomp.ncomp.sirius.manager.Jetty8Server; import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.manager.IRequestHandler; import org.openecomp.ncomp.sirius.manager.ISiriusServer; import org.openecomp.ncomp.docker.DockerAdaptor; @@ -47,7 +49,7 @@ import org.openecomp.ncomp.servers.docker.gui.DockerModelFactory; -public class DockerDockerAdaptorServer implements ISiriusServer { +public class DockerDockerAdaptorServer implements ISiriusServer, IRequestHandler { public static final Logger logger = Logger.getLogger(DockerDockerAdaptorServer.class); String serverPath; ManagementServer server; @@ -56,6 +58,7 @@ public class DockerDockerAdaptorServer implements ISiriusServer { // LocationControllerApi api ; Jetty8Server webServer; DockerDockerFactory f = new DockerDockerFactory(this); + String hostPath; ManagementServer hostServer; @@ -70,6 +73,7 @@ public class DockerDockerAdaptorServer implements ISiriusServer { props = getPropertiesFromClasspath(filename); serverPath = (String) props.get("server.dir"); server = new ManagementServer(f, "DockerAdaptor", serverPath, filename); + ManagementServer.setBuildVersion("ONAP-R2"); server.addFactory(f); server.addRuntimeFactories(this); @@ -79,6 +83,7 @@ public class DockerDockerAdaptorServer implements ISiriusServer { controller = (DockerDockerAdaptor) server.find("/").o; webServer = new Jetty8Server("docker.properties"); webServer.add("/resources",server); + webServer.add("/api",this); @@ -107,4 +112,17 @@ public class DockerDockerAdaptorServer implements ISiriusServer { public ManagementServer getServer() { return server; } + public Object handleJson(String userName, String action, String resourcePath, JSONObject json, JSONObject context, + String clientVersion) { + switch ((String) context.get("path")) { + case "/api/versions": + return server.supportedVersions(); + } + logger.warn("Unknown request action=" + action + " path=" + resourcePath + " context=" + context.toString(2)); + throw new RuntimeException("Unknown request"); + } + public Object handleBinary(String userName, String action, String resourcePath, InputStream in) { + return null; + } + } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java index d16b4ff..74492fe 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHost.java @@ -23,27 +23,48 @@ // Do not edit. No need to extend this class. package org.openecomp.ncomp.servers.docker; + + + + import java.io.InputStream; + import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISwaggerHandler; import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.manager.ISiriusProvider; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.manager.SwaggerUtils; import org.openecomp.ncomp.sirius.function.FunctionUtils; import org.openecomp.ncomp.component.ApiRequestStatus; import org.apache.log4j.Logger; + +import org.openecomp.ncomp.sirius.manager.logging.NcompLogger; +import org.openecomp.logger.StatusCodeEnum; +import org.openecomp.logger.EcompException; + import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; import org.json.JSONObject; + import java.util.Date; +import org.openecomp.ncomp.servers.docker.logging.DockerHostOperationEnum; +import org.openecomp.ncomp.servers.docker.logging.DockerHostMessageEnum; + + import org.openecomp.ncomp.docker.impl.DockerHostImpl; -public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { +public class DockerDockerHost extends DockerHostImpl implements ISiriusProvider, ISiriusPlugin { public static final Logger logger = Logger.getLogger(DockerDockerHost.class); - DockerDockerHostProvider controller; + static final NcompLogger ecomplogger = NcompLogger.getNcompLogger(); + public DockerDockerHostProvider controller; ISiriusServer server; public DockerDockerHost(ISiriusServer server) { @@ -57,6 +78,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "poll", ApiRequestStatus.START, duration_); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_poll,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_poll,"self:" + ManagementServer.object2ref(this)); try { controller.poll(); } @@ -65,8 +88,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "poll", ApiRequestStatus.ERROR, duration_); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_poll, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_poll,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_poll, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "poll", ApiRequestStatus.OKAY, duration_); @@ -79,6 +106,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.START, duration_,name); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_startContainer,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_startContainer,"self:" + ManagementServer.object2ref(this)); try { controller.startContainer(name); } @@ -87,8 +116,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.ERROR, duration_,name); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_startContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_startContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_startContainer, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "startContainer", ApiRequestStatus.OKAY, duration_,name); @@ -101,6 +134,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.START, duration_,name,seconds); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_stopContainer,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_stopContainer,"self:" + ManagementServer.object2ref(this)); try { controller.stopContainer(name,seconds); } @@ -109,8 +144,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.ERROR, duration_,name,seconds); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_stopContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_stopContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_stopContainer, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "stopContainer", ApiRequestStatus.OKAY, duration_,name,seconds); @@ -123,6 +162,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.START, duration_,name,seconds); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_restartContainer,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_restartContainer,"self:" + ManagementServer.object2ref(this)); try { controller.restartContainer(name,seconds); } @@ -131,8 +172,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.ERROR, duration_,name,seconds); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_restartContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_restartContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_restartContainer, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "restartContainer", ApiRequestStatus.OKAY, duration_,name,seconds); @@ -145,6 +190,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.START, duration_,name); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_pauseContainer,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_pauseContainer,"self:" + ManagementServer.object2ref(this)); try { controller.pauseContainer(name); } @@ -153,8 +200,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.ERROR, duration_,name); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_pauseContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_pauseContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_pauseContainer, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "pauseContainer", ApiRequestStatus.OKAY, duration_,name); @@ -167,6 +218,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.START, duration_,name); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_unpauseContainer,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_unpauseContainer,"self:" + ManagementServer.object2ref(this)); try { controller.unpauseContainer(name); } @@ -175,8 +228,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.ERROR, duration_,name); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_unpauseContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_unpauseContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_unpauseContainer, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "unpauseContainer", ApiRequestStatus.OKAY, duration_,name); @@ -189,6 +246,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.START, duration_,name,remove,force); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_removeContainer,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_removeContainer,"self:" + ManagementServer.object2ref(this)); try { controller.removeContainer(name,remove,force); } @@ -197,8 +256,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.ERROR, duration_,name,remove,force); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_removeContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_removeContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_removeContainer, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "removeContainer", ApiRequestStatus.OKAY, duration_,name,remove,force); @@ -211,6 +274,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.START, duration_,name); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_inspectContainer,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_inspectContainer,"self:" + ManagementServer.object2ref(this)); try { controller.inspectContainer(name); } @@ -219,8 +284,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.ERROR, duration_,name); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_inspectContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_inspectContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_inspectContainer, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "inspectContainer", ApiRequestStatus.OKAY, duration_,name); @@ -233,6 +302,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.START, duration_,name,sigint); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_killContainer,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_killContainer,"self:" + ManagementServer.object2ref(this)); try { controller.killContainer(name,sigint); } @@ -241,8 +312,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.ERROR, duration_,name,sigint); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_killContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_killContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_killContainer, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "killContainer", ApiRequestStatus.OKAY, duration_,name,sigint); @@ -255,6 +330,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.START, duration_,image); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_dockerRun,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_dockerRun,"self:" + ManagementServer.object2ref(this)); try { controller.dockerRun(image); } @@ -263,8 +340,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.ERROR, duration_,image); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_dockerRun, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_dockerRun,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_dockerRun, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "dockerRun", ApiRequestStatus.OKAY, duration_,image); @@ -277,6 +358,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.START, duration_,image,name); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_dockerRunWithName,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_dockerRunWithName,"self:" + ManagementServer.object2ref(this)); try { controller.dockerRunWithName(image,name); } @@ -285,8 +368,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.ERROR, duration_,image,name); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_dockerRunWithName, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_dockerRunWithName,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_dockerRunWithName, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "dockerRunWithName", ApiRequestStatus.OKAY, duration_,image,name); @@ -299,6 +386,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.START, duration_,image,opts); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_dockerRunWithOptions,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_dockerRunWithOptions,"self:" + ManagementServer.object2ref(this)); try { controller.dockerRunWithOptions(image,opts); } @@ -307,8 +396,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.ERROR, duration_,image,opts); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_dockerRunWithOptions, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_dockerRunWithOptions,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_dockerRunWithOptions, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "dockerRunWithOptions", ApiRequestStatus.OKAY, duration_,image,opts); @@ -321,6 +414,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.START, duration_,name,stream); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_containerStats,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_containerStats,"self:" + ManagementServer.object2ref(this)); try { controller.containerStats(name,stream); } @@ -329,8 +424,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.ERROR, duration_,name,stream); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_containerStats, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_containerStats,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_containerStats, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "containerStats", ApiRequestStatus.OKAY, duration_,name,stream); @@ -343,6 +442,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.START, duration_,name); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(DockerHostOperationEnum.DockerHost_containerProcesses,server,this); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_containerProcesses,"self:" + ManagementServer.object2ref(this)); try { controller.containerProcesses(name); } @@ -351,8 +452,12 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { if (server != null) server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.ERROR, duration_,name); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(DockerHostMessageEnum.REQUEST_FAILED_containerProcesses, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REQUEST_FAILED_containerProcesses,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, DockerHostMessageEnum.REQUEST_FAILED_containerProcesses, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "containerProcesses", ApiRequestStatus.OKAY, duration_,name); @@ -364,6 +469,8 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { + + @Override public void start() { controller.start(); @@ -372,7 +479,7 @@ public class DockerDockerHost extends DockerHostImpl implements ISiriusPlugin { public static void ecoreSetup() { DockerDockerHostProvider.ecoreSetup(); } - public DockerDockerHostProvider getSomfProvider() { + public DockerDockerHostProvider getSiriusProvider() { return controller; } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostClient.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostClient.java index aa468c9..7cf9823 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostClient.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/DockerDockerHostClient.java @@ -28,10 +28,18 @@ import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient; import org.openecomp.ncomp.sirius.manager.GenericHttpClient; import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; +import org.openecomp.logger.StatusCodeEnum; +import org.openecomp.logger.EcompException; + import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; + import org.openecomp.ncomp.docker.impl.DockerHostImpl; import org.openecomp.ncomp.docker.DockerPackage; +import org.openecomp.ncomp.servers.docker.logging.DockerHostOperationEnum; +import org.openecomp.ncomp.servers.docker.logging.DockerHostMessageEnum; import org.openecomp.ncomp.servers.docker.DockerDockerAdaptor; @@ -42,109 +50,281 @@ import org.openecomp.ncomp.servers.docker.DockerDockerAdaptor; @SuppressWarnings("unchecked") public class DockerDockerHostClient extends DockerHostImpl { public static final Logger logger = Logger.getLogger(DockerDockerHostClient.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); public AbstractClient client; public DockerDockerHostClient(String file, String name) { DockerDockerAdaptor.ecoreSetup(); client = new GenericHttpClient(file,name); client.add("/host", this); + client.setVersion("ONAP-R2"); } public DockerDockerHostClient(String file, String name1, String name2) { HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2); client = client1.all; // requests should be forwarded to all. client.add("/host", this); + client.setVersion("ONAP-R2"); } public DockerDockerHostClient(AbstractClient c) { client = c; client.add("/resources", this); + client.setVersion("ONAP-R2"); } public void poll(String path) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "poll", null); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_poll,client.getRemote()); + + try { + client.operationPath(path, c, "poll", null); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_poll, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_poll,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_poll,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void startContainer(String path, java.lang.String name) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "startContainer", null, name); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_startContainer,client.getRemote()); + + try { + client.operationPath(path, c, "startContainer", null, name); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_startContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_startContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_startContainer,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void stopContainer(String path, java.lang.String name, int seconds) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "stopContainer", null, name,seconds); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_stopContainer,client.getRemote()); + + try { + client.operationPath(path, c, "stopContainer", null, name,seconds); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_stopContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_stopContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_stopContainer,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void restartContainer(String path, java.lang.String name, int seconds) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "restartContainer", null, name,seconds); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_restartContainer,client.getRemote()); + + try { + client.operationPath(path, c, "restartContainer", null, name,seconds); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_restartContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_restartContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_restartContainer,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void pauseContainer(String path, java.lang.String name) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "pauseContainer", null, name); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_pauseContainer,client.getRemote()); + + try { + client.operationPath(path, c, "pauseContainer", null, name); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_pauseContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_pauseContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_pauseContainer,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void unpauseContainer(String path, java.lang.String name) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "unpauseContainer", null, name); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_unpauseContainer,client.getRemote()); + + try { + client.operationPath(path, c, "unpauseContainer", null, name); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_unpauseContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_unpauseContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_unpauseContainer,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void removeContainer(String path, java.lang.String name, boolean remove, boolean force) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "removeContainer", null, name,remove,force); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_removeContainer,client.getRemote()); + + try { + client.operationPath(path, c, "removeContainer", null, name,remove,force); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_removeContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_removeContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_removeContainer,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void inspectContainer(String path, java.lang.String name) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "inspectContainer", null, name); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_inspectContainer,client.getRemote()); + + try { + client.operationPath(path, c, "inspectContainer", null, name); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_inspectContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_inspectContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_inspectContainer,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void killContainer(String path, java.lang.String name, java.lang.String sigint) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "killContainer", null, name,sigint); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_killContainer,client.getRemote()); + + try { + client.operationPath(path, c, "killContainer", null, name,sigint); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_killContainer, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_killContainer,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_killContainer,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void dockerRun(String path, java.lang.String image) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "dockerRun", null, image); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_dockerRun,client.getRemote()); + + try { + client.operationPath(path, c, "dockerRun", null, image); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRun, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRun,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRun,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void dockerRunWithName(String path, java.lang.String image, java.lang.String name) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "dockerRunWithName", null, image,name); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_dockerRunWithName,client.getRemote()); + + try { + client.operationPath(path, c, "dockerRunWithName", null, image,name); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRunWithName, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRunWithName,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRunWithName,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void dockerRunWithOptions(String path, java.lang.String image, org.openecomp.ncomp.docker.ContainerOptions opts) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "dockerRunWithOptions", null, image,opts); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_dockerRunWithOptions,client.getRemote()); + + try { + client.operationPath(path, c, "dockerRunWithOptions", null, image,opts); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRunWithOptions, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRunWithOptions,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_dockerRunWithOptions,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void containerStats(String path, java.lang.String name, boolean stream) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "containerStats", null, name,stream); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_containerStats,client.getRemote()); + + try { + client.operationPath(path, c, "containerStats", null, name,stream); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_containerStats, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_containerStats,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_containerStats,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } public void containerProcesses(String path, java.lang.String name) { - EClass c = DockerPackage.eINSTANCE.getDockerHost(); //foo - client.operationPath(path, c, "containerProcesses", null, name); + EClass c = DockerPackage.eINSTANCE.getDockerHost(); + ecomplogger.recordMetricEventStart(DockerHostOperationEnum.DockerHost_containerProcesses,client.getRemote()); + + try { + client.operationPath(path, c, "containerProcesses", null, name); + } + catch (Exception e) { + ecomplogger.warn(DockerHostMessageEnum.REMOTE_CALL_FAILED_containerProcesses, e.toString()); + EcompException e1 = EcompException.create(DockerHostMessageEnum.REMOTE_CALL_FAILED_containerProcesses,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,DockerHostMessageEnum.REMOTE_CALL_FAILED_containerProcesses,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApi.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApi.java index 95966f5..49cae38 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApi.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApi.java @@ -23,18 +23,40 @@ // Do not edit. No need to extend this class. package org.openecomp.ncomp.servers.docker.gui; + + + + import java.io.InputStream; + import org.openecomp.ncomp.sirius.manager.IRequestHandler; +import org.openecomp.ncomp.sirius.manager.ISwaggerHandler; import org.openecomp.ncomp.sirius.manager.ISiriusPlugin; import org.openecomp.ncomp.sirius.manager.ISiriusServer; +import org.openecomp.ncomp.sirius.manager.ISiriusProvider; +import org.openecomp.ncomp.sirius.manager.ManagementServer; +import org.openecomp.ncomp.sirius.manager.SwaggerUtils; import org.openecomp.ncomp.sirius.function.FunctionUtils; import org.openecomp.ncomp.component.ApiRequestStatus; import org.apache.log4j.Logger; + +import org.openecomp.ncomp.sirius.manager.logging.NcompLogger; +import org.openecomp.logger.StatusCodeEnum; +import org.openecomp.logger.EcompException; + import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; import org.json.JSONObject; + import java.util.Date; +import org.openecomp.ncomp.servers.docker.gui.logging.GuiClientApiOperationEnum; +import org.openecomp.ncomp.servers.docker.gui.logging.GuiClientApiMessageEnum; + + + + @@ -42,18 +64,26 @@ import org.openecomp.ncomp.sirius.gui.tools.*; + + import org.openecomp.ncomp.gwt.siriusportal.model.*; + + import org.openecomp.ncomp.sirius.manager.Subject; + + import org.openecomp.ncomp.sirius.manager.ManagementServer; + + import org.openecomp.ncomp.sirius.manager.server.AbstractManagementServer; @@ -61,9 +91,10 @@ import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl; -public class DockerGuiClientApi extends GuiClientApiImpl { +public class DockerGuiClientApi extends GuiClientApiImpl implements ISiriusProvider { public static final Logger logger = Logger.getLogger(DockerGuiClientApi.class); - DockerGuiClientApiProvider controller; + static final NcompLogger ecomplogger = NcompLogger.getNcompLogger(); + public DockerGuiClientApiProvider controller; ISiriusServer server; public DockerGuiClientApi(ISiriusServer server) { @@ -77,6 +108,8 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.START, duration_); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(GuiClientApiOperationEnum.GuiClientApi_getTree,server,this); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getTree,"self:" + ManagementServer.object2ref(this)); try { res = controller.getTree(); } @@ -85,8 +118,12 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.ERROR, duration_); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(GuiClientApiMessageEnum.REQUEST_FAILED_getTree, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REQUEST_FAILED_getTree,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, GuiClientApiMessageEnum.REQUEST_FAILED_getTree, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getTree", ApiRequestStatus.OKAY, duration_); @@ -99,6 +136,8 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.START, duration_,path); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(GuiClientApiOperationEnum.GuiClientApi_getObject,server,this); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getObject,"self:" + ManagementServer.object2ref(this)); try { res = controller.getObject(path); } @@ -107,8 +146,12 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.ERROR, duration_,path); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(GuiClientApiMessageEnum.REQUEST_FAILED_getObject, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REQUEST_FAILED_getObject,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, GuiClientApiMessageEnum.REQUEST_FAILED_getObject, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getObject", ApiRequestStatus.OKAY, duration_,path); @@ -121,6 +164,8 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.START, duration_,path,start,end,duration); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(GuiClientApiOperationEnum.GuiClientApi_getTimeSerie,server,this); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getTimeSerie,"self:" + ManagementServer.object2ref(this)); try { res = controller.getTimeSerie(path,start,end,duration); } @@ -129,8 +174,12 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.ERROR, duration_,path,start,end,duration); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(GuiClientApiMessageEnum.REQUEST_FAILED_getTimeSerie, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REQUEST_FAILED_getTimeSerie,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, GuiClientApiMessageEnum.REQUEST_FAILED_getTimeSerie, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getTimeSerie", ApiRequestStatus.OKAY, duration_,path,start,end,duration); @@ -143,6 +192,8 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.START, duration_,path,start,end); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(GuiClientApiOperationEnum.GuiClientApi_getTable,server,this); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getTable,"self:" + ManagementServer.object2ref(this)); try { res = controller.getTable(path,start,end); } @@ -151,8 +202,12 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.ERROR, duration_,path,start,end); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(GuiClientApiMessageEnum.REQUEST_FAILED_getTable, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REQUEST_FAILED_getTable,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, GuiClientApiMessageEnum.REQUEST_FAILED_getTable, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getTable", ApiRequestStatus.OKAY, duration_,path,start,end); @@ -165,6 +220,8 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.START, duration_,path,start,end); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(GuiClientApiOperationEnum.GuiClientApi_getHtml,server,this); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getHtml,"self:" + ManagementServer.object2ref(this)); try { res = controller.getHtml(path,start,end); } @@ -173,8 +230,12 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.ERROR, duration_,path,start,end); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(GuiClientApiMessageEnum.REQUEST_FAILED_getHtml, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REQUEST_FAILED_getHtml,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, GuiClientApiMessageEnum.REQUEST_FAILED_getHtml, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getHtml", ApiRequestStatus.OKAY, duration_,path,start,end); @@ -187,6 +248,8 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.START, duration_,path,start,end); Date now_ = new Date(); + ecomplogger.recordAuditEventStartIfNeeded(GuiClientApiOperationEnum.GuiClientApi_getGraph,server,this); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getGraph,"self:" + ManagementServer.object2ref(this)); try { res = controller.getGraph(path,start,end); } @@ -195,8 +258,12 @@ public class DockerGuiClientApi extends GuiClientApiImpl { if (server != null) server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.ERROR, duration_,path,start,end); System.err.println("ERROR: " + e); - throw e; + ecomplogger.warn(GuiClientApiMessageEnum.REQUEST_FAILED_getGraph, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REQUEST_FAILED_getGraph,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR, GuiClientApiMessageEnum.REQUEST_FAILED_getGraph, e.getMessage()); + throw e1; } + ecomplogger.recordMetricEventEnd(); duration_ = new Date().getTime()-now_.getTime(); if (server != null) server.getServer().recordApi(null, this, "getGraph", ApiRequestStatus.OKAY, duration_,path,start,end); @@ -208,10 +275,12 @@ public class DockerGuiClientApi extends GuiClientApiImpl { + + public static void ecoreSetup() { DockerGuiClientApiProvider.ecoreSetup(); } - public DockerGuiClientApiProvider getSomfProvider() { + public DockerGuiClientApiProvider getSiriusProvider() { return controller; } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiClient.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiClient.java index 1cd8dd1..9aaee81 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiClient.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/DockerGuiClientApiClient.java @@ -28,10 +28,18 @@ import org.openecomp.ncomp.sirius.manager.HighAvailabilityClient; import org.openecomp.ncomp.sirius.manager.GenericHttpClient; import org.apache.log4j.Logger; + +import org.openecomp.logger.EcompLogger; +import org.openecomp.logger.StatusCodeEnum; +import org.openecomp.logger.EcompException; + import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; + import org.openecomp.ncomp.gwt.siriusportal.model.impl.GuiClientApiImpl; import org.openecomp.ncomp.gwt.siriusportal.model.ModelPackage; +import org.openecomp.ncomp.servers.docker.gui.logging.GuiClientApiOperationEnum; +import org.openecomp.ncomp.servers.docker.gui.logging.GuiClientApiMessageEnum; import org.openecomp.ncomp.servers.docker.DockerDockerAdaptor; @@ -42,61 +50,137 @@ import org.openecomp.ncomp.servers.docker.DockerDockerAdaptor; @SuppressWarnings("unchecked") public class DockerGuiClientApiClient extends GuiClientApiImpl { public static final Logger logger = Logger.getLogger(DockerGuiClientApiClient.class); + static final EcompLogger ecomplogger = EcompLogger.getEcompLogger(); public AbstractClient client; public DockerGuiClientApiClient(String file, String name) { DockerDockerAdaptor.ecoreSetup(); client = new GenericHttpClient(file,name); client.add("/gui", this); + client.setVersion("ONAP-R2"); } public DockerGuiClientApiClient(String file, String name1, String name2) { HighAvailabilityClient client1 = new HighAvailabilityClient(file,name1,name2); client = client1.all; // requests should be forwarded to all. client.add("/gui", this); + client.setVersion("ONAP-R2"); } public DockerGuiClientApiClient(AbstractClient c) { client = c; client.add("/resources", this); + client.setVersion("ONAP-R2"); } @Override public org.openecomp.ncomp.gwt.siriusportal.model.GuiTree getTree() { - EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo - return (org.openecomp.ncomp.gwt.siriusportal.model.GuiTree) client.operationPath("/gui", c, "getTree", null); + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getTree,client.getRemote()); + org.openecomp.ncomp.gwt.siriusportal.model.GuiTree res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiTree) client.operationPath("/gui", c, "getTree", null); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTree, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTree,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTree,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + return res; } @Override public org.openecomp.ncomp.gwt.siriusportal.model.GuiObject getObject(java.lang.String path) { - EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo - return (org.openecomp.ncomp.gwt.siriusportal.model.GuiObject) client.operationPath("/gui", c, "getObject", null, path); + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getObject,client.getRemote()); + org.openecomp.ncomp.gwt.siriusportal.model.GuiObject res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiObject) client.operationPath("/gui", c, "getObject", null, path); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getObject, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getObject,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getObject,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + return res; } @Override public org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie getTimeSerie(java.lang.String path, java.lang.String start, java.lang.String end, java.lang.String duration) { - EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo - return (org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie) client.operationPath("/gui", c, "getTimeSerie", null, path,start,end,duration); + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getTimeSerie,client.getRemote()); + org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiTimeSerie) client.operationPath("/gui", c, "getTimeSerie", null, path,start,end,duration); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTimeSerie, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTimeSerie,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTimeSerie,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + return res; } @Override public org.openecomp.ncomp.gwt.siriusportal.model.GuiTable getTable(java.lang.String path, java.lang.String start, java.lang.String end) { - EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo - return (org.openecomp.ncomp.gwt.siriusportal.model.GuiTable) client.operationPath("/gui", c, "getTable", null, path,start,end); + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getTable,client.getRemote()); + org.openecomp.ncomp.gwt.siriusportal.model.GuiTable res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiTable) client.operationPath("/gui", c, "getTable", null, path,start,end); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTable, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTable,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getTable,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + return res; } @Override public org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml getHtml(java.lang.String path, java.lang.String start, java.lang.String end) { - EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo - return (org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml) client.operationPath("/gui", c, "getHtml", null, path,start,end); + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getHtml,client.getRemote()); + org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml res; + try { + res = (org.openecomp.ncomp.gwt.siriusportal.model.GuiHtml) client.operationPath("/gui", c, "getHtml", null, path,start,end); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getHtml, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getHtml,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getHtml,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + return res; } @Override public org.openecomp.ncomp.sirius.manager.graph.GuiGraph getGraph(java.lang.String path, java.lang.String start, java.lang.String end) { - EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); //foo - return (org.openecomp.ncomp.sirius.manager.graph.GuiGraph) client.operationPath("/gui", c, "getGraph", null, path,start,end); + EClass c = ModelPackage.eINSTANCE.getGuiClientApi(); + ecomplogger.recordMetricEventStart(GuiClientApiOperationEnum.GuiClientApi_getGraph,client.getRemote()); + org.openecomp.ncomp.sirius.manager.graph.GuiGraph res; + try { + res = (org.openecomp.ncomp.sirius.manager.graph.GuiGraph) client.operationPath("/gui", c, "getGraph", null, path,start,end); + } + catch (Exception e) { + ecomplogger.warn(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getGraph, e.toString()); + EcompException e1 = EcompException.create(GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getGraph,e,e.getMessage()); + ecomplogger.recordMetricEventEnd(StatusCodeEnum.ERROR,GuiClientApiMessageEnum.REMOTE_CALL_FAILED_getGraph,e.getMessage()); + throw e1; + } + ecomplogger.recordMetricEventEnd(); + return res; } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi.properties b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi.properties index 8705ab8..3822d29 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi.properties +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi.properties @@ -1,78 +1,78 @@ dummy=\ - null|\ + dummy-null|\ null|\ null|\ null -getTree=\ - getTree-FAILED-5001W|\ +REQUEST_FAILED_getTree=\ + REQUEST-FAILED-getTree-4001W|\ {0}|\ null|\ Operation Failed with Exception -getObject=\ - getObject-FAILED-5001W|\ +REQUEST_FAILED_getObject=\ + REQUEST-FAILED-getObject-4001W|\ {0}|\ null|\ Operation Failed with Exception -getTimeSerie=\ - getTimeSerie-FAILED-5001W|\ +REQUEST_FAILED_getTimeSerie=\ + REQUEST-FAILED-getTimeSerie-4001W|\ {0}|\ null|\ Operation Failed with Exception -getTable=\ - getTable-FAILED-5001W|\ +REQUEST_FAILED_getTable=\ + REQUEST-FAILED-getTable-4001W|\ {0}|\ null|\ Operation Failed with Exception -getHtml=\ - getHtml-FAILED-5001W|\ +REQUEST_FAILED_getHtml=\ + REQUEST-FAILED-getHtml-4001W|\ {0}|\ null|\ Operation Failed with Exception -getGraph=\ - getGraph-FAILED-5001W|\ +REQUEST_FAILED_getGraph=\ + REQUEST-FAILED-getGraph-4001W|\ {0}|\ null|\ Operation Failed with Exception -REMOTE_getTree=\ - REMOTE-getTree-FAILED-5001W|\ +REMOTE_CALL_FAILED_getTree=\ + REMOTE-CALL-FAILED-getTree-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_getObject=\ - REMOTE-getObject-FAILED-5001W|\ +REMOTE_CALL_FAILED_getObject=\ + REMOTE-CALL-FAILED-getObject-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_getTimeSerie=\ - REMOTE-getTimeSerie-FAILED-5001W|\ +REMOTE_CALL_FAILED_getTimeSerie=\ + REMOTE-CALL-FAILED-getTimeSerie-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_getTable=\ - REMOTE-getTable-FAILED-5001W|\ +REMOTE_CALL_FAILED_getTable=\ + REMOTE-CALL-FAILED-getTable-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_getHtml=\ - REMOTE-getHtml-FAILED-5001W|\ +REMOTE_CALL_FAILED_getHtml=\ + REMOTE-CALL-FAILED-getHtml-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_getGraph=\ - REMOTE-getGraph-FAILED-5001W|\ +REMOTE_CALL_FAILED_getGraph=\ + REMOTE-CALL-FAILED-getGraph-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiMessageEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiMessageEnum.java index dfcab12..587ec73 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiMessageEnum.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiMessageEnum.java @@ -1,25 +1,4 @@ -/*- - * ============LICENSE_START========================================== - * OPENECOMP - DCAE - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - */ - - package org.openecomp.ncomp.servers.docker.gui.logging; import com.att.eelf.i18n.EELFResourceManager; @@ -28,20 +7,20 @@ import org.openecomp.logger.EcompMessageEnum; public enum GuiClientApiMessageEnum implements EcompMessageEnum { dummy, - getTree, - getObject, - getTimeSerie, - getTable, - getHtml, - getGraph, - REMOTE_getTree, - REMOTE_getObject, - REMOTE_getTimeSerie, - REMOTE_getTable, - REMOTE_getHtml, - REMOTE_getGraph; + REQUEST_FAILED_getTree, + REQUEST_FAILED_getObject, + REQUEST_FAILED_getTimeSerie, + REQUEST_FAILED_getTable, + REQUEST_FAILED_getHtml, + REQUEST_FAILED_getGraph, + REMOTE_CALL_FAILED_getTree, + REMOTE_CALL_FAILED_getObject, + REMOTE_CALL_FAILED_getTimeSerie, + REMOTE_CALL_FAILED_getTable, + REMOTE_CALL_FAILED_getHtml, + REMOTE_CALL_FAILED_getGraph; static { - EELFResourceManager.loadMessageBundle("org.openecomp.ncomp.servers.docker.gui.logging.GuiClientApi"); + EELFResourceManager.loadMessageBundle("org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApi"); } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiOperationEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiOperationEnum.java index d14cf24..8497b5b 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiOperationEnum.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/gui/logging/GuiClientApiOperationEnum.java @@ -1,41 +1,27 @@ -/*- - * ============LICENSE_START========================================== - * OPENECOMP - DCAE - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - */ - - package org.openecomp.ncomp.servers.docker.gui.logging; import org.openecomp.entity.EcompOperationEnum; public enum GuiClientApiOperationEnum implements EcompOperationEnum { - getTree, - getObject, - getTimeSerie, - getTable, - getHtml, - getGraph, - REMOTE_getTree, - REMOTE_getObject, - REMOTE_getTimeSerie, - REMOTE_getTable, - REMOTE_getHtml, - REMOTE_getGraph; + GuiClientApi_getTree("GuiClientApi@getTree"), + GuiClientApi_getObject("GuiClientApi@getObject"), + GuiClientApi_getTimeSerie("GuiClientApi@getTimeSerie"), + GuiClientApi_getTable("GuiClientApi@getTable"), + GuiClientApi_getHtml("GuiClientApi@getHtml"), + GuiClientApi_getGraph("GuiClientApi@getGraph") ; + + + private String n; + + private GuiClientApiOperationEnum(String n) { + this.n = n; + } + + @Override + public String toString() { + return n; + } + } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptor.properties b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptor.properties index 555c4fc..11f5270 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptor.properties +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptor.properties @@ -1,6 +1,6 @@ dummy=\ - null|\ + dummy-null|\ null|\ null|\ null diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorMessageEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorMessageEnum.java index 2efd8de..6bf960c 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorMessageEnum.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorMessageEnum.java @@ -1,25 +1,4 @@ -/*- - * ============LICENSE_START========================================== - * OPENECOMP - DCAE - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - */ - - package org.openecomp.ncomp.servers.docker.logging; import com.att.eelf.i18n.EELFResourceManager; @@ -30,6 +9,6 @@ public enum DockerAdaptorMessageEnum implements EcompMessageEnum { dummy; static { - EELFResourceManager.loadMessageBundle("org.openecomp.ncomp.servers.docker.logging.DockerAdaptor"); + EELFResourceManager.loadMessageBundle("org/openecomp/ncomp/servers/docker/logging/DockerAdaptor"); } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorOperationEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorOperationEnum.java index 8a36bca..ec29998 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorOperationEnum.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerAdaptorOperationEnum.java @@ -1,29 +1,21 @@ -/*- - * ============LICENSE_START========================================== - * OPENECOMP - DCAE - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - */ - - package org.openecomp.ncomp.servers.docker.logging; import org.openecomp.entity.EcompOperationEnum; public enum DockerAdaptorOperationEnum implements EcompOperationEnum { + ; + + + private String n; + + private DockerAdaptorOperationEnum(String n) { + this.n = n; + } + + @Override + public String toString() { + return n; + } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHost.properties b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHost.properties index b815973..588fd0f 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHost.properties +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHost.properties @@ -1,186 +1,174 @@ dummy=\ - null|\ + dummy-null|\ null|\ null|\ null -poll=\ - poll-FAILED-5001W|\ - {0}|\ - null|\ - Operation Failed with Exception - -startContainer=\ - startContainer-FAILED-5001W|\ +REQUEST_FAILED_poll=\ + REQUEST-FAILED-poll-4001W|\ {0}|\ null|\ Operation Failed with Exception -stopContainer=\ - stopContainer-FAILED-5001W|\ +REQUEST_FAILED_startContainer=\ + REQUEST-FAILED-startContainer-4001W|\ {0}|\ null|\ Operation Failed with Exception -restartContainer=\ - restartContainer-FAILED-5001W|\ +REQUEST_FAILED_stopContainer=\ + REQUEST-FAILED-stopContainer-4001W|\ {0}|\ null|\ Operation Failed with Exception -pauseContainer=\ - pauseContainer-FAILED-5001W|\ +REQUEST_FAILED_restartContainer=\ + REQUEST-FAILED-restartContainer-4001W|\ {0}|\ null|\ Operation Failed with Exception -unpauseContainer=\ - unpauseContainer-FAILED-5001W|\ +REQUEST_FAILED_pauseContainer=\ + REQUEST-FAILED-pauseContainer-4001W|\ {0}|\ null|\ Operation Failed with Exception -removeContainer=\ - removeContainer-FAILED-5001W|\ +REQUEST_FAILED_unpauseContainer=\ + REQUEST-FAILED-unpauseContainer-4001W|\ {0}|\ null|\ Operation Failed with Exception -inspectContainer=\ - inspectContainer-FAILED-5001W|\ +REQUEST_FAILED_removeContainer=\ + REQUEST-FAILED-removeContainer-4001W|\ {0}|\ null|\ Operation Failed with Exception -killContainer=\ - killContainer-FAILED-5001W|\ +REQUEST_FAILED_inspectContainer=\ + REQUEST-FAILED-inspectContainer-4001W|\ {0}|\ null|\ Operation Failed with Exception -dockerRun=\ - dockerRun-FAILED-5001W|\ +REQUEST_FAILED_killContainer=\ + REQUEST-FAILED-killContainer-4001W|\ {0}|\ null|\ Operation Failed with Exception -dockerRunWithName=\ - dockerRunWithName-FAILED-5001W|\ +REQUEST_FAILED_dockerRun=\ + REQUEST-FAILED-dockerRun-4001W|\ {0}|\ null|\ Operation Failed with Exception -dockerRunWithOptions=\ - dockerRunWithOptions-FAILED-5001W|\ +REQUEST_FAILED_dockerRunWithName=\ + REQUEST-FAILED-dockerRunWithName-4001W|\ {0}|\ null|\ Operation Failed with Exception -containerStats=\ - containerStats-FAILED-5001W|\ +REQUEST_FAILED_dockerRunWithOptions=\ + REQUEST-FAILED-dockerRunWithOptions-4001W|\ {0}|\ null|\ Operation Failed with Exception -containerProcesses=\ - containerProcesses-FAILED-5001W|\ +REQUEST_FAILED_containerStats=\ + REQUEST-FAILED-containerStats-4001W|\ {0}|\ null|\ Operation Failed with Exception -pullImage=\ - pullImage-FAILED-5001W|\ +REQUEST_FAILED_containerProcesses=\ + REQUEST-FAILED-containerProcesses-4001W|\ {0}|\ null|\ Operation Failed with Exception -REMOTE_poll=\ - REMOTE-poll-FAILED-5001W|\ - {0}|\ - null|\ - Remote Operation Failed with Exception - -REMOTE_startContainer=\ - REMOTE-startContainer-FAILED-5001W|\ +REMOTE_CALL_FAILED_poll=\ + REMOTE-CALL-FAILED-poll-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_stopContainer=\ - REMOTE-stopContainer-FAILED-5001W|\ +REMOTE_CALL_FAILED_startContainer=\ + REMOTE-CALL-FAILED-startContainer-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_restartContainer=\ - REMOTE-restartContainer-FAILED-5001W|\ +REMOTE_CALL_FAILED_stopContainer=\ + REMOTE-CALL-FAILED-stopContainer-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_pauseContainer=\ - REMOTE-pauseContainer-FAILED-5001W|\ +REMOTE_CALL_FAILED_restartContainer=\ + REMOTE-CALL-FAILED-restartContainer-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_unpauseContainer=\ - REMOTE-unpauseContainer-FAILED-5001W|\ +REMOTE_CALL_FAILED_pauseContainer=\ + REMOTE-CALL-FAILED-pauseContainer-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_removeContainer=\ - REMOTE-removeContainer-FAILED-5001W|\ +REMOTE_CALL_FAILED_unpauseContainer=\ + REMOTE-CALL-FAILED-unpauseContainer-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_inspectContainer=\ - REMOTE-inspectContainer-FAILED-5001W|\ +REMOTE_CALL_FAILED_removeContainer=\ + REMOTE-CALL-FAILED-removeContainer-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_killContainer=\ - REMOTE-killContainer-FAILED-5001W|\ +REMOTE_CALL_FAILED_inspectContainer=\ + REMOTE-CALL-FAILED-inspectContainer-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_dockerRun=\ - REMOTE-dockerRun-FAILED-5001W|\ +REMOTE_CALL_FAILED_killContainer=\ + REMOTE-CALL-FAILED-killContainer-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_dockerRunWithName=\ - REMOTE-dockerRunWithName-FAILED-5001W|\ +REMOTE_CALL_FAILED_dockerRun=\ + REMOTE-CALL-FAILED-dockerRun-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_dockerRunWithOptions=\ - REMOTE-dockerRunWithOptions-FAILED-5001W|\ +REMOTE_CALL_FAILED_dockerRunWithName=\ + REMOTE-CALL-FAILED-dockerRunWithName-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_containerStats=\ - REMOTE-containerStats-FAILED-5001W|\ +REMOTE_CALL_FAILED_dockerRunWithOptions=\ + REMOTE-CALL-FAILED-dockerRunWithOptions-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_containerProcesses=\ - REMOTE-containerProcesses-FAILED-5001W|\ +REMOTE_CALL_FAILED_containerStats=\ + REMOTE-CALL-FAILED-containerStats-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception -REMOTE_pullImage=\ - REMOTE-pullImage-FAILED-5001W|\ +REMOTE_CALL_FAILED_containerProcesses=\ + REMOTE-CALL-FAILED-containerProcesses-4001W|\ {0}|\ null|\ Remote Operation Failed with Exception diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostMessageEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostMessageEnum.java index aa1d5a2..ceb5e8d 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostMessageEnum.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostMessageEnum.java @@ -1,25 +1,4 @@ -/*- - * ============LICENSE_START========================================== - * OPENECOMP - DCAE - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - */ - - package org.openecomp.ncomp.servers.docker.logging; import com.att.eelf.i18n.EELFResourceManager; @@ -28,38 +7,36 @@ import org.openecomp.logger.EcompMessageEnum; public enum DockerHostMessageEnum implements EcompMessageEnum { dummy, - poll, - startContainer, - stopContainer, - restartContainer, - pauseContainer, - unpauseContainer, - removeContainer, - inspectContainer, - killContainer, - dockerRun, - dockerRunWithName, - dockerRunWithOptions, - containerStats, - containerProcesses, - pullImage, - REMOTE_poll, - REMOTE_startContainer, - REMOTE_stopContainer, - REMOTE_restartContainer, - REMOTE_pauseContainer, - REMOTE_unpauseContainer, - REMOTE_removeContainer, - REMOTE_inspectContainer, - REMOTE_killContainer, - REMOTE_dockerRun, - REMOTE_dockerRunWithName, - REMOTE_dockerRunWithOptions, - REMOTE_containerStats, - REMOTE_containerProcesses, - REMOTE_pullImage; + REQUEST_FAILED_poll, + REQUEST_FAILED_startContainer, + REQUEST_FAILED_stopContainer, + REQUEST_FAILED_restartContainer, + REQUEST_FAILED_pauseContainer, + REQUEST_FAILED_unpauseContainer, + REQUEST_FAILED_removeContainer, + REQUEST_FAILED_inspectContainer, + REQUEST_FAILED_killContainer, + REQUEST_FAILED_dockerRun, + REQUEST_FAILED_dockerRunWithName, + REQUEST_FAILED_dockerRunWithOptions, + REQUEST_FAILED_containerStats, + REQUEST_FAILED_containerProcesses, + REMOTE_CALL_FAILED_poll, + REMOTE_CALL_FAILED_startContainer, + REMOTE_CALL_FAILED_stopContainer, + REMOTE_CALL_FAILED_restartContainer, + REMOTE_CALL_FAILED_pauseContainer, + REMOTE_CALL_FAILED_unpauseContainer, + REMOTE_CALL_FAILED_removeContainer, + REMOTE_CALL_FAILED_inspectContainer, + REMOTE_CALL_FAILED_killContainer, + REMOTE_CALL_FAILED_dockerRun, + REMOTE_CALL_FAILED_dockerRunWithName, + REMOTE_CALL_FAILED_dockerRunWithOptions, + REMOTE_CALL_FAILED_containerStats, + REMOTE_CALL_FAILED_containerProcesses; static { - EELFResourceManager.loadMessageBundle("org.openecomp.ncomp.servers.docker.logging.DockerHost"); + EELFResourceManager.loadMessageBundle("org/openecomp/ncomp/servers/docker/logging/DockerHost"); } } diff --git a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostOperationEnum.java b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostOperationEnum.java index 211c5a7..018c136 100644 --- a/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostOperationEnum.java +++ b/ncomp-docker-adaptor/src/main/sirius-gen/org/openecomp/ncomp/servers/docker/logging/DockerHostOperationEnum.java @@ -1,59 +1,35 @@ -/*- - * ============LICENSE_START========================================== - * OPENECOMP - DCAE - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - */ - - package org.openecomp.ncomp.servers.docker.logging; import org.openecomp.entity.EcompOperationEnum; public enum DockerHostOperationEnum implements EcompOperationEnum { - poll, - startContainer, - stopContainer, - restartContainer, - pauseContainer, - unpauseContainer, - removeContainer, - inspectContainer, - killContainer, - dockerRun, - dockerRunWithName, - dockerRunWithOptions, - containerStats, - containerProcesses, - pullImage, - REMOTE_poll, - REMOTE_startContainer, - REMOTE_stopContainer, - REMOTE_restartContainer, - REMOTE_pauseContainer, - REMOTE_unpauseContainer, - REMOTE_removeContainer, - REMOTE_inspectContainer, - REMOTE_killContainer, - REMOTE_dockerRun, - REMOTE_dockerRunWithName, - REMOTE_dockerRunWithOptions, - REMOTE_containerStats, - REMOTE_containerProcesses, - REMOTE_pullImage; + DockerHost_poll("DockerHost@poll"), + DockerHost_startContainer("DockerHost@startContainer"), + DockerHost_stopContainer("DockerHost@stopContainer"), + DockerHost_restartContainer("DockerHost@restartContainer"), + DockerHost_pauseContainer("DockerHost@pauseContainer"), + DockerHost_unpauseContainer("DockerHost@unpauseContainer"), + DockerHost_removeContainer("DockerHost@removeContainer"), + DockerHost_inspectContainer("DockerHost@inspectContainer"), + DockerHost_killContainer("DockerHost@killContainer"), + DockerHost_dockerRun("DockerHost@dockerRun"), + DockerHost_dockerRunWithName("DockerHost@dockerRunWithName"), + DockerHost_dockerRunWithOptions("DockerHost@dockerRunWithOptions"), + DockerHost_containerStats("DockerHost@containerStats"), + DockerHost_containerProcesses("DockerHost@containerProcesses") ; + + + private String n; + + private DockerHostOperationEnum(String n) { + this.n = n; + } + + @Override + public String toString() { + return n; + } + } |