Skip to content

Commit

Permalink
Add initial implementation of version control
Browse files Browse the repository at this point in the history
Prepare for #35

Signed-off-by: jensenzhang <[email protected]>
  • Loading branch information
fno2010 committed Mar 24, 2023
1 parent 1ddf608 commit c09ec02
Show file tree
Hide file tree
Showing 9 changed files with 404 additions and 83 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ MANIFEST
.venv*/
.conda*/
.python-version

# User local file
etc/alto.conf
14 changes: 14 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ This ALTO toolset includes the following basic components:
Server Deployment
=================

Before you set up an OpenALTO server, make sure you have ``alto.conf`` in one of
the following locations:

* ``$HOME/.alto/``
* ``$XDG_CONFIG_HOME/alto/``
* ``$ALTO_HOME/etc/``
* ``/opt/alto/etc/``

You can simply copy our template as an example, or modify it:

.. code-block:: bash
$ cp etc/alto.conf.template etc/alto.conf
Quick set up with ``docker`` and ``docker-compose``:

.. code-block:: bash
Expand Down
83 changes: 0 additions & 83 deletions etc/alto.conf

This file was deleted.

6 changes: 6 additions & 0 deletions etc/alto.conf.test
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ resources = {
"params": {
"data_source": "geoip"}}}


[server.vcs]
# Configuration for version control system
zookeeper_host = zoo1
zookeeper_timeout = 15

####################################################
# Common configuratoin
####################################################
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ exclude =
# PDF = ReportLab; RXP
redis = redis
geoip = geoip2
vcs = kazoo

# Add here test requirements (semicolon/line-separated)
testing =
Expand Down
8 changes: 8 additions & 0 deletions src/alto/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,26 @@
ALTO_CONTENT_TYPE_CM_PV = 'multipart/related;type={}'.format(ALTO_CONTENT_TYPE_CM)
ALTO_CONTENT_TYPE_ECS_PV = 'multipart/related;type={}'.format(ALTO_CONTENT_TYPE_ECS)

ALTO_PARAMETER_TYPE_FNM = 'application/alto-networkmapfilter+json'
ALTO_PARAMETER_TYPE_FCM = 'application/alto-costmapfilter+json'
ALTO_PARAMETER_TYPE_ECS = 'application/alto-endpointcostparams+json'
ALTO_PARAMETER_TYPE_EPS = 'application/alto-endpointpropparams+json'
ALTO_PARAMETER_TYPE_PROPMAP = 'application/alto-propmapparams+json'

ALTO_CONTENT_TYPES = {
"ird": ALTO_CONTENT_TYPE_IRD,
"network-map": ALTO_CONTENT_TYPE_NM,
"cost-map": ALTO_CONTENT_TYPE_CM,
"endpoint-cost": ALTO_CONTENT_TYPE_ECS,
"endpoint-prop": ALTO_CONTENT_TYPE_EPS,
"path-vector": ALTO_CONTENT_TYPE_ECS_PV,
"cost-map-pv": ALTO_CONTENT_TYPE_CM_PV,
"entity-prop": ALTO_CONTENT_TYPE_PROPMAP
}

ALTO_PARAMETER_TYPES = {
"filtered-network-map": ALTO_PARAMETER_TYPE_FNM,
"filtered-cost-map": ALTO_PARAMETER_TYPE_FCM,
"endpoint-cost": ALTO_PARAMETER_TYPE_ECS,
"path-vector": ALTO_PARAMETER_TYPE_ECS,
"entity-prop": ALTO_PARAMETER_TYPE_PROPMAP
Expand Down
10 changes: 10 additions & 0 deletions src/alto/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,13 @@ def get_server_cost_types(self):
cost_types_json = self.parser.get('server', 'cost_types', fallback=None)
if cost_types_json:
return json.loads(cost_types_json.strip())


def get_vcs_zookeeper_host(self):
self.parser.read(self.location)
return self.parser.get('server.vcs', 'zookeeper_host', fallback=None)


def get_vcs_zookeeper_timeout(self):
self.parser.read(self.location)
return int(self.parser.get('server.vcs', 'zookeeper_timeout', fallback=15))
Loading

0 comments on commit c09ec02

Please sign in to comment.