Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Add etcd directories for custom bird filters #150

Merged
merged 1 commit into from
Oct 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions calico_containers/pycalico/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
BGP_HOST_AS_PATH = BGP_HOST_PATH + "as_num"
BGP_HOST_PEERS_PATH = BGP_HOST_PATH + "peer_v%(version)s/"
BGP_HOST_PEER_PATH = BGP_HOST_PATH + "peer_v%(version)s/%(peer_ip)s"
BGP_CUSTOM_FILTERS_PATH = BGP_GLOBAL_PATH + "custom_filters/"
BGP_CUSTOM_FILTERS_IPV4_PATH = BGP_CUSTOM_FILTERS_PATH + "v4/"
BGP_CUSTOM_FILTERS_IPV6_PATH = BGP_CUSTOM_FILTERS_PATH + "v6/"

# Grabs hostname from etcd datastore keys
HOSTNAME_IP_DATASTORE_RE = re.compile(BGP_HOSTS_PATH + "(.*)/ip_addr_v[46]")
Expand Down Expand Up @@ -273,6 +276,10 @@ def ensure_global_config(self):
self._write_global_dir(affinity_path)
self._write_global_dir(pool_path)

# create directories for custom filters
self._write_global_dir(BGP_CUSTOM_FILTERS_IPV4_PATH)
self._write_global_dir(BGP_CUSTOM_FILTERS_IPV6_PATH)

# Configure BGP global (default) config if it doesn't exist.
self._write_global_config(BGP_NODE_DEF_AS_PATH, str(DEFAULT_AS_NUM))
self._write_global_config(BGP_NODE_MESH_PATH,
Expand Down
8 changes: 8 additions & 0 deletions calico_containers/tests/unit/test_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
TEST_NODE_BGP_PEERS_PATH = TEST_BGP_HOST_PATH + "/peer_v4/"
TEST_NODE_BGP_PEERS_V6_PATH = TEST_BGP_HOST_PATH + "/peer_v6/"

BGP_CUSTOM_FILTERS_PATH = BGP_GLOBAL_PATH + "/custom_filters/"
BGP_CUSTOM_FILTERS_IPV4_PATH = BGP_CUSTOM_FILTERS_PATH + "v4/"
BGP_CUSTOM_FILTERS_IPV6_PATH = BGP_CUSTOM_FILTERS_PATH + "v6/"

IPAM_V4_PATH = "/calico/ipam/v2/host/THIS_HOST/ipv4/block/"
IPAM_V6_PATH = "/calico/ipam/v2/host/THIS_HOST/ipv6/block/"

Expand Down Expand Up @@ -590,6 +594,8 @@ def test_ensure_global_config(self, m_gethostname):
call(IPV4_POOLS_PATH, None, dir=True),
call(IPAM_V6_PATH, None, dir=True),
call(IPV6_POOLS_PATH, None, dir=True),
call(BGP_CUSTOM_FILTERS_IPV4_PATH, None, dir=True),
call(BGP_CUSTOM_FILTERS_IPV6_PATH, None, dir=True),
call(BGP_NODE_DEF_AS_PATH, "64511"),
call(BGP_NODE_MESH_PATH, json.dumps({"enabled": True})),
call(log_file_path, "none"),
Expand Down Expand Up @@ -631,6 +637,8 @@ def explode(path, value, **kwargs):
call(IPV4_POOLS_PATH, None, dir=True),
call(IPAM_V6_PATH, None, dir=True),
call(IPV6_POOLS_PATH, None, dir=True),
call(BGP_CUSTOM_FILTERS_IPV4_PATH, None, dir=True),
call(BGP_CUSTOM_FILTERS_IPV6_PATH, None, dir=True),
call(BGP_NODE_DEF_AS_PATH, "64511"),
call(BGP_NODE_MESH_PATH, json.dumps({"enabled": True})),
call(log_file_path, "none"),
Expand Down