1 /*************************************************************************
3 * Copyright 2019 highstreet technologies GmbH and others
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 ***************************************************************************/
18 #ifndef SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_
19 #define SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_
21 #include <curl/curl.h>
27 #include "sysrepo/values.h"
29 #include <cjson/cJSON.h>
31 #define CURL_MEM_SIZE 2048
35 * Storing the device information
38 typedef struct device {
42 char *operational_state;
46 typedef struct device_stack {
51 #define URL_AND_CREDENTIALS_MAX_LEN 400
53 typedef struct controller
55 char url[URL_AND_CREDENTIALS_MAX_LEN];
56 char credentials[URL_AND_CREDENTIALS_MAX_LEN];
57 char url_for_keystore_add[URL_AND_CREDENTIALS_MAX_LEN];
58 char url_for_private_key_add[URL_AND_CREDENTIALS_MAX_LEN];
59 char url_for_trusted_ca_add[URL_AND_CREDENTIALS_MAX_LEN];
63 device_stack_t *new_device_stack(void);
64 void push_device(device_stack_t *theStack, char *dev_id, int port);
65 void pop_device(device_stack_t *theStack);
66 int get_netconf_port_next(device_stack_t *theStack);
67 int get_netconf_port_base(void);
68 char *get_id_last_device(device_stack_t *theStack);
69 int get_current_number_of_devices(device_stack_t *theStack);
70 int get_current_number_of_mounted_devices(device_stack_t *theStack);
83 int cleanup_curl(void);
85 int _init_curl_odl(void);
86 int cleanup_curl_odl(void);
88 int start_device(device_stack_t *theStack);
89 int stop_device(device_stack_t *theStack);
91 int mount_device(device_stack_t *theStack, controller_t controller_details);
92 int unmount_device(device_stack_t *theStack, controller_t controller_details);
94 char* get_docker_container_operational_state(device_stack_t *theStack, char *container_id);
95 int get_docker_containers_operational_state_curl(device_stack_t *theStack);
97 char* get_docker_container_resource_stats();
99 int notification_delay_period_changed(int period);
100 int ves_heartbeat_period_changed(int period);
101 int ves_ip_changed(char *new_ip);
102 int ves_port_changed(int new_port);
103 int ves_registration_changed(cJSON_bool new_bool);
104 int is_netconf_available_changed(cJSON_bool new_bool);
105 int is_ves_available_changed(cJSON_bool new_bool);
109 int add_key_pair_to_odl(controller_t *controller_list, int controller_list_size);
112 #endif /* SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_ */