[CORD-2720] Removing consul and registrator as they're not used
Change-Id: I734c97f842f5bb54c6558e7b0c81d60097a16537
diff --git a/docs/modules/xosconfig.md b/docs/modules/xosconfig.md
index ae3708f..6f3cb5c 100644
--- a/docs/modules/xosconfig.md
+++ b/docs/modules/xosconfig.md
@@ -64,78 +64,4 @@
"test"
```
-The configuration schema is defined in `/lib/xos-config/config-schema.yaml`
-
-### Reading Service Information
-
-XOS is composed of a set of services. To discover these services and their
-address, use the [registrator](https://github.com/gliderlabs/registrator) tool.
-
-#### Retrieving a List of Services
-
-Invoking
-
-```python
-from xosconfig import Config
-Config.get_service_list()
-```
-
-returns an array of available services; by default:
-
-```python
-[
- "xos-ws",
- "xos-ui-deprecated",
- "xos-rest",
- "xos-gui",
- "xos-db",
- "consul-rest",
- "consul",
-]
-```
-
-> NOTE: You can get the same information on the `head node` using:
->
-> ```bash
-> curl consul:8500/v1/catalog/services
-> ```
-
-#### Retrieving Information for a Single Service
-
-Invoking
-
-```python
-from xosconfig import Config
-Config.get_service_info('xos-db')
-```
-
-returns
-
-```python
-{
- 'name': 'xos-db',
- 'url': '172.18.0.4',
- 'port': 5432
-}
-```
-
-> NOTE: You can get the same information on the `head node` using:
-> ```bash
-> curl consul:8500/v1/catalog/service/xos-db
-> ```
-
-#### Retrieving Endpoint for a Single Service
-
-Invoking
-
-```python
-from xosconfig import Config
-Config.get_service_endpoint('xos-db')
-```
-
-returns
-
-```python
-"http://172.18.0.4:5432"
-```
-
+**The configuration schema is defined in `/lib/xos-config/config-schema.yaml`**
diff --git a/docs/xos_internals.md b/docs/xos_internals.md
index 4d261eb..2d0c052 100644
--- a/docs/xos_internals.md
+++ b/docs/xos_internals.md
@@ -14,10 +14,7 @@
| xos-ws | Listens to `redis` events and propagates them over web-sockets for notifications| 3000|
| xos-chameleon | Northbound REST interface, accessible at `/xosapi/v1/..` (`swagger` is published at `/apidocs/`| 3000|
-Additionally some infrastructure helpers such as `consul` and `registrator` are
-deployed to facilitate service discovery.
-
-All the communication between containers happen over `gRPC` except for
-`xos-gui` where it is a combination of REST and web-socket.
+All the communication between containers happen over `gRPC` except for `xos-gui`
+where it is a combination of REST and web-socket.
![xos-containers](./static/xos_containers.png)
diff --git a/lib/xos-config/tests/test_config.py b/lib/xos-config/tests/test_config.py
index bc9ad13..29635ce 100644
--- a/lib/xos-config/tests/test_config.py
+++ b/lib/xos-config/tests/test_config.py
@@ -186,61 +186,5 @@
res = Config.get("nested.parameter.for")
self.assertEqual(res, "testing")
- def test_get_service_list(self):
- """
- [XOS-Config] Should query registrator and return a list of services
- """
- with patch("xosconfig.config.requests.get") as mock_get:
- mock_get.return_value.json.return_value = services_list
- res = Config.get_service_list()
- self.assertEqual(res, [
- "xos-ws",
- "xos-db",
- ])
-
- def test_get_service_info(self):
- """
- [XOS-Config] Should query registrator and return service info
- """
- with patch("xosconfig.config.requests.get") as mock_get:
- mock_get.return_value.json.return_value = db_service
- info = Config.get_service_info("xos-db")
- self.assertEqual(info, {
- "name": "xos-db",
- "url": "172.18.0.4",
- "port": 5432
- })
-
- def test_fail_get_service_info(self):
- """
- [XOS-Config] Should query registrator and return an exception if it"s down
- """
- with patch("xosconfig.config.requests.get") as mock_get:
- mock_get.return_value.ok = False
- with self.assertRaises(Exception) as e:
- Config.get_service_info("missing-service")
- self.assertEqual(e.exception.message, "[XOS-Config] Registrator is down")
-
- def test_missing_get_service_info(self):
- """
- [XOS-Config] Should query registrator and return an exception if service is not there
- """
- with patch("xosconfig.config.requests.get") as mock_get:
- mock_get.return_value.json.return_value = []
- with self.assertRaises(Exception) as e:
- Config.get_service_info("missing-service")
- self.assertEqual(e.exception.message, "[XOS-Config] The service missing-service looking for does not exist")
-
-
- def test_get_service_endpoint(self):
- """
- [XOS-Config] Should query registrator and return service endpoint
- """
- with patch("xosconfig.config.requests.get") as mock_get:
- mock_get.return_value.json.return_value = db_service
- endpoint = Config.get_service_endpoint("xos-db")
- self.assertEqual(endpoint, "http://172.18.0.4:5432")
-
-
if __name__ == '__main__':
unittest.main()
diff --git a/lib/xos-config/xosconfig/config.py b/lib/xos-config/xosconfig/config.py
index ba8e75d..4e6af9e 100644
--- a/lib/xos-config/xosconfig/config.py
+++ b/lib/xos-config/xosconfig/config.py
@@ -202,48 +202,5 @@
param = param[k]
return param
- @staticmethod
- def get_service_list():
- """
- Query registrator to get the list of services
- NOTE: we assume that consul is a valid URL
- :return: a list of service names
- """
- service_dict = requests.get('http://consul:8500/v1/catalog/services').json()
- service_list = []
- for s in service_dict:
- service_list.append(s)
- return service_list
-
- @staticmethod
- def get_service_info(service_name):
- """
- Query registrator to get the details about a service
- NOTE: we assume that consul is a valid URL
- :param service_name: the name of the service, can be retrieved from get_service_list
- :return: the informations about a service
- """
- response = requests.get('http://consul:8500/v1/catalog/service/%s' % service_name)
- if not response.ok:
- raise Exception('[XOS-Config] Registrator is down')
- service = response.json()
- if not service or len(service) == 0:
- raise Exception('[XOS-Config] The service missing-service looking for does not exist')
- return {
- 'name': service[0]['ServiceName'],
- 'url': service[0]['ServiceAddress'],
- 'port': service[0]['ServicePort']
- }
-
- @staticmethod
- def get_service_endpoint(service_name):
- """
- Query registrator to get the details about a service and return the endpoint in for of a string
- :param service_name: the name of the service, can be retrieved from get_service_list
- :return: the endpoint of the service
- """
- service = Config.get_service_info(service_name)
- return 'http://%s:%s' % (service['url'], service['port'])
-
if __name__ == '__main__':
Config.init()