X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fntsim-ng%2Fcore%2Fdocker.c;h=aea7ae86f76cfb714913e960aa797e089585d83b;hb=22cd30649dfac2fcfdf233765aa7feeea7141d96;hp=92edc79e2241d851405dec3c1609aac2451c3a54;hpb=c7e43513c1c4c3569d5079db0a9a31c124274e6c;p=sim%2Fo1-interface.git diff --git a/ntsimulator/ntsim-ng/core/docker.c b/ntsimulator/ntsim-ng/core/docker.c index 92edc79..aea7ae8 100644 --- a/ntsimulator/ntsim-ng/core/docker.c +++ b/ntsimulator/ntsim-ng/core/docker.c @@ -446,12 +446,6 @@ static int docker_add_port(cJSON *portBindings, uint16_t docker_port, uint16_t h return NTS_ERR_FAILED; } - if(cJSON_AddStringToObject(hostPort, "HostIp", "0.0.0.0") == 0) { //or, future, bind to container->host_ip - log_error("could not create JSON object: HostIpString\n"); - cJSON_Delete(hostPort); - return NTS_ERR_FAILED; - } - if(cJSON_AddItemToArray(port, hostPort) == 0) { log_error("cJSON_AddItemToArray failed\n"); cJSON_Delete(hostPort); @@ -561,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; }