X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fo1-interface.git;a=blobdiff_plain;f=ntsimulator%2Fntsim-ng%2Fcore%2Fdocker.c;h=aea7ae86f76cfb714913e960aa797e089585d83b;hp=3d5faa26b305aaa84e39660298ccba6d5243aa63;hb=22cd30649dfac2fcfdf233765aa7feeea7141d96;hpb=d070d2aa9ae02f9da264d4ca782335f527429b1c diff --git a/ntsimulator/ntsim-ng/core/docker.c b/ntsimulator/ntsim-ng/core/docker.c index 3d5faa2..aea7ae8 100644 --- a/ntsimulator/ntsim-ng/core/docker.c +++ b/ntsimulator/ntsim-ng/core/docker.c @@ -555,9 +555,33 @@ static int docker_container_create(const char *image, docker_container_t *contai return NTS_ERR_FAILED; } + cJSON *capAdd = cJSON_CreateArray(); + if(capAdd == 0) { + log_error("could not create JSON array: CapAdd\n"); + cJSON_Delete(postDataJson); + return NTS_ERR_FAILED; + } + if(cJSON_AddItemToObject(hostConfig, "CapAdd", capAdd) == 0) { + log_error("cJSON_AddItemToObject failed\n"); + cJSON_Delete(postDataJson); + return NTS_ERR_FAILED; + } + cJSON *net_admin = cJSON_CreateString("NET_ADMIN"); + if(net_admin == 0) { + log_error("could not create JSON string\n"); + cJSON_Delete(postDataJson); + return NTS_ERR_FAILED; + } + if(cJSON_AddItemToArray(capAdd, net_admin) == 0) { + log_error("cJSON_AddItemToArray failed\n"); + cJSON_Delete(postDataJson); + return NTS_ERR_FAILED; + } + + cJSON *portBindings = cJSON_CreateObject(); if(portBindings == 0) { - printf("could not create JSON object: PortBindings"); + log_error("could not create JSON object: PortBindings\n"); cJSON_Delete(postDataJson); return NTS_ERR_FAILED; }