Skip to content
Open
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
9 changes: 1 addition & 8 deletions ecsclient/common/monitoring/dashboard.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# Standard lib imports
import logging

# Third party imports
# None

# Project level imports
# None


log = logging.getLogger(__name__)

Expand Down Expand Up @@ -48,7 +41,7 @@ def get_local_zone_replication_groups(self):

Too large to output here
"""
log.info("Getting vpools in local VDC")
log.info("Getting local VDC replication groups details")
return self.conn.get(url='dashboard/zones/localzone/replicationgroups')

def get_local_zone_rglinks_failed(self):
Expand Down
195 changes: 195 additions & 0 deletions ecsclient/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,3 +857,198 @@
"totalProvisioned_gb"
]
}

DASHBOARD_REPLICATION_GROUP_TRAFFIC = {
"type": "object",
"properties": {
"Bandwidth": {"type": "string"},
"t": {"type": "string"},
},
"required": [
"Bandwidth",
"t"
]
}

DASHBOARD_REPLICATION_GROUP_TRAFFIC_SUMMARY = {
"type": "object",
"properties": {
"Max": {
"type": "array",
"minItems": 0,
"items": DASHBOARD_REPLICATION_GROUP_TRAFFIC
},
"Min": {
"type": "array",
"minItems": 0,
"items": DASHBOARD_REPLICATION_GROUP_TRAFFIC
},
"Avg": {"type": "string"},
},
"required": [
"Max",
"Min",
"Avg"
]
}

DASHBOARD_REPLICATION_GROUP = {
"type": "object",
"properties": {
"chunksRepoPendingReplicationTotalSize": {"type": "string"},
"chunksJournalPendingReplicationTotalSize": {"type": "string"},
"chunksPendingXorTotalSize": {"type": "string"},
"name": {"type": "string"},
"id": {"type": "string"},
"numZones": {"type": "string"},
"apiChange": {"type": "string"},
"replicationIngressTrafficSummary": DASHBOARD_REPLICATION_GROUP_TRAFFIC_SUMMARY,
"replicationEgressTrafficSummary": DASHBOARD_REPLICATION_GROUP_TRAFFIC_SUMMARY,
"replicationIngressTraffic": {
"type": "array",
"minItems": 0,
"items": DASHBOARD_REPLICATION_GROUP_TRAFFIC
},
"replicationEgressTraffic": {
"type": "array",
"minItems": 0,
"items": DASHBOARD_REPLICATION_GROUP_TRAFFIC
},
"_links": {
"type": "object",
"properties": {
"self": {
"type": "object",
"properties": {
"href": {"type": "string"},
},
"required": [
"href",
]
},
"rglinks": {
"type": "object",
"properties": {
"href": {"type": "string"},
},
"required": [
"href",
]
},
"datatables": {
"type": "object",
"properties": {
"href": {"type": "string"},
},
"required": [
"href",
]
}
},
"required": [
"self",
"rglinks",
"datatables",
]
},
},
"required": [
"chunksRepoPendingReplicationTotalSize",
"chunksJournalPendingReplicationTotalSize",
"chunksPendingXorTotalSize",
"name",
"id",
"numZones",
"apiChange",
"replicationIngressTrafficSummary",
"replicationEgressTrafficSummary",
"replicationIngressTraffic",
"replicationEgressTraffic",
"_links"
]
}

DASHBOARD_REPLICATION_GROUPS = {
"type": "object",
"properties": {
"title": {"type": "string"},
"_links": {
"type": "object",
"properties": {
"self": {
"type": "object",
"properties": {
"href": {"type": "string"},
},
"required": [
"href",
]
}
},
"required": [
"self",
]
},
"_embedded": {
"type": "object",
"properties": {
"_instances": {
"type": "array",
"minItems": 1,
"items": DASHBOARD_REPLICATION_GROUP
}
},
"required": [
"_instances",
]
},

},
"required": [
"title",
"_links",
"_embedded"
]
}

DASHBOARD_NODES = {
"type": "object",
"properties": {
"title": {"type": "string"},
"_links": {
"type": "object",
"properties": {
"self": {
"type": "object",
"properties": {
"href": {"type": "string"},
},
"required": [
"href",
]
}
},
"required": [
"self",
]
},
"_embedded": {
"type": "object",
"properties": {
"_instances": {
"type": "array",
"minItems": 1,
}
},
"required": [
"_instances",
]
},

},
"required": [
"title",
"_links",
"_embedded"
]
}
3 changes: 2 additions & 1 deletion tests/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def _get_client(self):
username=self.username,
password=self.password,
ecs_endpoint=self.ecs_endpoint,
token_endpoint=self.token_endpoint)
token_endpoint=self.token_endpoint,
request_timeout=60.0)

def setUp(self):
super(BaseTestCase, self).setUp()
Expand Down
19 changes: 19 additions & 0 deletions tests/functional/test_dashboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from ecsclient import schemas
from tests import functional


class TestDashboard(functional.BaseTestCase):

def __test_get_local_zone_replication_groups(self):
response = self.client.dashboard.get_local_zone_replication_groups()
self.assertValidSchema(response, schemas.DASHBOARD_REPLICATION_GROUPS)

def __test_get_local_zone_nodes(self):
response = self.client.dashboard.get_local_zone_nodes()
# TODO: complete the schema to validate the full response
self.assertValidSchema(response, schemas.DASHBOARD_NODES)

def test_get_node_disks(self):
response = self.client.dashboard.get_node_disks()
print(response)
# self.assertValidSchema(response, schemas.DASHBOARD_NODES)