X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fsrc%2Fntsimulator-manager%2Fsimulator-operations.h;fp=ntsimulator%2Fsrc%2Fntsimulator-manager%2Fsimulator-operations.h;h=f61784e677d3f923940563878e85553c0bd3da11;hb=29ce368a8b49cb41f3a1640581ff9958ea50ad8c;hp=0000000000000000000000000000000000000000;hpb=1d6c03fcfde03df735f82913ea795a75cd3068d9;p=sim%2Fo1-interface.git diff --git a/ntsimulator/src/ntsimulator-manager/simulator-operations.h b/ntsimulator/src/ntsimulator-manager/simulator-operations.h new file mode 100644 index 0000000..f61784e --- /dev/null +++ b/ntsimulator/src/ntsimulator-manager/simulator-operations.h @@ -0,0 +1,102 @@ +/* + * simulator-operations.h + * + * Created on: Mar 9, 2019 + * Author: parallels + */ + +#ifndef SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_ +#define SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_ + +#include +#include +#include +#include + +#include "sysrepo.h" +#include "sysrepo/values.h" + +#include + +#define CURL_MEM_SIZE 2048 + + +/** + * Storing the device information +*/ + +typedef struct device { + char *device_id; + int netconf_port; + bool is_mounted; + char *operational_state; + struct device *next; +} device_t; + +typedef struct device_stack { + device_t *head; + size_t stack_size; +} device_stack_t; + +#define URL_AND_CREDENTIALS_MAX_LEN 400 + +typedef struct controller +{ + char url[URL_AND_CREDENTIALS_MAX_LEN]; + char credentials[URL_AND_CREDENTIALS_MAX_LEN]; + char url_for_keystore_add[URL_AND_CREDENTIALS_MAX_LEN]; + char url_for_private_key_add[URL_AND_CREDENTIALS_MAX_LEN]; + char url_for_trusted_ca_add[URL_AND_CREDENTIALS_MAX_LEN]; +} controller_t; + + +device_stack_t *new_device_stack(void); +void push_device(device_stack_t *theStack, char *dev_id, int port); +void pop_device(device_stack_t *theStack); +int get_netconf_port_next(device_stack_t *theStack); +int get_netconf_port_base(void); +char *get_id_last_device(device_stack_t *theStack); +int get_current_number_of_devices(device_stack_t *theStack); +int get_current_number_of_mounted_devices(device_stack_t *theStack); + + +/** + * cURL utilities +*/ + +struct MemoryStruct { + char *memory; + size_t size; +}; + +int _init_curl(void); +int cleanup_curl(void); + +int _init_curl_odl(void); +int cleanup_curl_odl(void); + +int start_device(device_stack_t *theStack); +int stop_device(device_stack_t *theStack); + +int mount_device(device_stack_t *theStack, controller_t controller_details); +int unmount_device(device_stack_t *theStack, controller_t controller_details); + +char* get_docker_container_operational_state(device_stack_t *theStack, char *container_id); +int get_docker_containers_operational_state_curl(device_stack_t *theStack); + +char* get_docker_container_resource_stats(); + +int notification_delay_period_changed(int period); +int ves_heartbeat_period_changed(int period); +int ves_ip_changed(char *new_ip); +int ves_port_changed(int new_port); +int ves_registration_changed(cJSON_bool new_bool); +int is_netconf_available_changed(cJSON_bool new_bool); +int is_ves_available_changed(cJSON_bool new_bool); + + + +int add_key_pair_to_odl(controller_t *controller_list, int controller_list_size); + + +#endif /* SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_ */