Skip to content

Commit

Permalink
checks: nodes.internationalConnections.country not set
Browse files Browse the repository at this point in the history
  • Loading branch information
jarofgreen committed Oct 18, 2022
1 parent 0e30a27 commit d57b6d8
Show file tree
Hide file tree
Showing 3 changed files with 379 additions and 0 deletions.
23 changes: 23 additions & 0 deletions libcoveofds/lib/common_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,33 @@ def skip_if_any_related_resources(self) -> bool:
return False


class NodeInternationalConnectionCountryAdditionalCheckForNetwork(
AdditionalCheckForNetwork
):
def check_node_first_pass(self, node: dict):
if "internationalConnections" in node and isinstance(
node["internationalConnections"], list
):
for international_connection in node["internationalConnections"]:
if isinstance(
international_connection, dict
) and not international_connection.get("country"):
self._additional_check_results.append(
{
"type": "node_international_connections_country_not_set",
"node_id": node.get("id"),
}
)

def skip_if_any_related_resources(self) -> bool:
return False


ADDITIONAL_CHECK_CLASSES_FOR_NETWORK = [
LinksMustHaveValidNodesAdditionalCheckForNetwork,
NodesLocationAndLinksRouteAdditionalCheckForNetwork,
PhaseReferenceAdditionalCheckForNetwork,
NodeInternationalConnectionCountryAdditionalCheckForNetwork,
]


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
{
"networks": [
{
"id": "a096d627-72e1-4f9b-b129-951b1737bff4",
"name": "Ghana Fibre Network",
"nodes": [
{
"id": "1",
"name": "Accra",
"phase": {
"id": "1",
"name": "NextGen Phase 1"
},
"status": "operational",
"location": {
"type": "Point",
"coordinates": [
-0.174,
5.625
]
},
"address": {
"streetAddress": "Boundary Rd",
"locality": "Shiashie",
"region": "Accra",
"postalCode": "12345",
"country": "GH"
},
"type": [
"pop"
],
"accessPoint": true,
"internationalConnections": [
{
"region": "Lomé"
}
],
"power": true,
"technologies": [
"ip"
],
"physicalInfrastructureProvider": {
"id": "GH-RGD-CS111111111",
"name": "FibreCo"
},
"networkProvider": {
"id": "GH-RGD-CS222222222",
"name": "FastWeb"
}
},
{
"id": "2",
"name": "Kumasi",
"phase": {
"id": "1",
"name": "NextGen Phase 1"
},
"status": "operational",
"location": {
"type": "Point",
"coordinates": [
-1.628,
6.711
]
},
"address": {
"streetAddress": "Kejetia Road",
"locality": "Bantama",
"region": "Kumasi",
"postalCode": "00000",
"country": "GH"
},
"type": [
"pop"
],
"accessPoint": false,
"power": true,
"technologies": [
"ip"
],
"physicalInfrastructureProvider": {
"id": "GH-RGD-CS111111111",
"name": "FibreCo"
},
"networkProvider": {
"id": "GH-RGD-CS222222222",
"name": "FastWeb"
}
}
],
"links": [
{
"id": "1",
"name": "Accra to Kumasi",
"phase": {
"id": "1",
"name": "NextGen Phase 1"
},
"status": "operational",
"readyForServiceDate": "2018-01-01",
"start": "1",
"end": "2",
"directed": false,
"route": {
"type": "LineString",
"coordinates": [
[
-0.173,
5.626
],
[
-0.178,
5.807
],
[
-0.112,
5.971
],
[
-0.211,
5.963
],
[
-0.321,
6.170
],
[
-0.488,
6.290
],
[
-0.560,
6.421
],
[
-0.752,
6.533
],
[
-0.867,
6.607
],
[
-1.101,
6.585
],
[
-1.304,
6.623
],
[
-1.461,
6.727
],
[
-1.628,
6.713
]
]
},
"physicalInfrastructureProvider": {
"id": "GH-RGD-CS111111111",
"name": "FibreCo"
},
"networkProvider": {
"id": "GH-RGD-CS222222222",
"name": "FastWeb"
},
"supplier": {
"id": "GH-RGD-CS333333333",
"name": "ProjectCo"
},
"transmissionMedium": [
"fibre"
],
"deployment": [
"belowGround"
],
"deploymentDetails": {
"description": "Buried in ducts"
},
"darkFibre": true,
"fibreType": "G.652",
"fibreTypeDetails": {
"description": "CABLED STANDARD ENHANCED SINGLEMODE FIBRE ESMF, LOW WATER PEAK SINGLE MODE FIBRE G.652.D, OS2"
},
"fibreCount": 24,
"fibreLength": 276000,
"technologies": [
"sdh"
],
"capacity": 4.976,
"capacityDetails": {
"description": "2xSTM-16"
},
"countries": [
"GH"
]
}
],
"phases": [
{
"id": "1",
"name": "NextGen Phase 1",
"description": "The first phase of the Ghana Fibre Network NextGen roll-out.",
"funders": [
{
"id": "1",
"name": "Ghana Infrastructure Investment Fund"
}
]
}
],
"organisations": [
{
"id": "GH-RGD-CS111111111",
"name": "FibreCo",
"identifier": {
"id": "CS111111111",
"scheme": "GH-RGD",
"legalName": "FibreCo Ghana Limited",
"uri": "https://example.com/companies/CS111111111"
},
"country": "GH",
"roles": [
"physicalInfrastructureProvider"
],
"roleDetails": "FibreCo owns and maintains the physical infrastructure.",
"website": "https://www.example.com",
"logo": "https://www.example.com/logo.png"
},
{
"id": "GH-RGD-CS222222222",
"name": "FastWeb",
"identifier": {
"id": "CS222222222",
"scheme": "GH-RGD",
"legalName": "FastWeb Ghana Limited",
"uri": "https://example.com/companies/CS222222222"
},
"country": "GH",
"roles": [
"networkProvider"
],
"roleDetails": "FastWeb provides wholesale services to service providers and dark fibre access to other network providers.",
"website": "https://www.example.com",
"logo": "https://www.example.com/logo.png"
},
{
"id": "GH-RGD-CS333333333",
"name": "ProjectCo",
"identifier": {
"id": "CS333333333",
"scheme": "GH-RGD",
"legalName": "ProjectCo Ghana Limited",
"uri": "https://example.com/companies/CS333333333"
},
"country": "GH",
"roles": [
"supplier"
],
"roleDetails": "ProjectCo was responsible for the construction of phase 1 of the NextGen network.",
"website": "https://www.example.com",
"logo": "https://www.example.com/logo.png"
},
{
"id": "1",
"name": "Ghana Infrastructure Investment Fund",
"country": "GH",
"roles": [
"funder"
],
"roleDetails": "The Ghana Infrastructure Investment Fund provided equity financing for the construction of phase 1 of the NextGen network.",
"website": "https://www.example.com",
"logo": "https://www.example.com/logo.png"
}
],
"contracts": [
{
"id": "1",
"title": "NextGen Phase 1 Construction Contract",
"description": "Contract for the construction of phase 1 of the NextGen network.",
"type": "private",
"value": {
"amount": 1537459500.00,
"currency": "GHS"
},
"dateSigned": "2016-06-30",
"documents": [
{
"title": "NextGen Phase 1 Construction Contract",
"description": "Signed contract.",
"url": "http://example.com/contracts/nextgen-phase1-construction.pdf",
"format": "application/pdf"
}
],
"relatedPhases": [
{
"id": "1",
"name": "NextGen Phase 1"
}
]
}
],
"website": "http://example.com/network",
"publisher": {
"id": "GH-RGD-CS111111111",
"name": "FibreCo",
"identifier": {
"id": "CS111111111",
"scheme": "GH-RGD",
"legalName": "FibreCo Ghana Limited",
"uri": "https://example.com/companies/CS111111111"
},
"country": "GH",
"website": "https://www.example.com",
"logo": "https://www.example.com/logo.png"
},
"publicationDate": "2022-01-01",
"collectionDate": "2021-09-30",
"crs": {
"name": "urn:ogc:def:crs:OGC::CRS84",
"uri": "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
},
"accuracy": 250,
"accuracyDetails": "Measured according to the US National Standard for Spatial Data Accuracy.",
"language": "en"
}
]
}
26 changes: 26 additions & 0 deletions tests/test_api_0_1_0_alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,29 @@ def test_phase_reference_name_set_but_not_in_original_1():
"node_id": "2",
"type": "node_phase_reference_name_set_but_not_in_original",
}


def test_node_international_connections_country_not_set_1():

cove_temp_folder = tempfile.mkdtemp(
prefix="lib-cove-ofds-tests-", dir=tempfile.gettempdir()
)
json_filename = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"fixtures",
"0_1_0_alpha",
"node_international_connections_country_not_set_1.json",
)

results = ofds_json_output(cove_temp_folder, json_filename)

assert results["schema_version"] == "0.1.0-alpha"

assert results["validation_errors_count"] == 0

assert results["additional_checks_count"] == 1
assert results["additional_checks"][0] == {
"network_id": "a096d627-72e1-4f9b-b129-951b1737bff4",
"node_id": "1",
"type": "node_international_connections_country_not_set",
}

0 comments on commit d57b6d8

Please sign in to comment.