• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atlanticwave-sdx / sdx-controller / 18915548677

29 Oct 2025 04:44PM UTC coverage: 55.206% (-0.03%) from 55.233%
18915548677

Pull #499

github

web-flow
Merge cf9395424 into b4e05fd58
Pull Request #499: Change domain list to dict

34 of 71 new or added lines in 3 files covered. (47.89%)

3 existing lines in 1 file now uncovered.

1246 of 2257 relevant lines covered (55.21%)

1.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.87
/sdx_controller/controllers/topology_controller.py
1
from flask import current_app
2✔
2
from sdx_datamodel.constants import Constants, MongoCollections
2✔
3
from sdx_pce.topology.grenmlconverter import GrenmlConverter
2✔
4

5
from sdx_controller.utils.db_utils import DbUtils
2✔
6

7
# Get DB connection and tables set up.
8
db_instance = DbUtils()
2✔
9
db_instance.initialize_db()
2✔
10

11

12
def get_topology():  # noqa: E501
2✔
13
    """get an existing topology
14

15
    ID of the topology # noqa: E501
16

17

18
    :rtype: str
19
    """
20
    topo_val = db_instance.get_value_from_db(
2✔
21
        MongoCollections.TOPOLOGIES, Constants.LATEST_TOPOLOGY
22
    )
23

24
    # TODO: this is a workaround because of the way we read values
25
    # from MongoDB; refactor and test this more.
26
    if not topo_val:
2✔
27
        return None
2✔
28

29
    return topo_val
×
30

31

32
def get_topologyby_grenml():  # noqa: E501
2✔
33
    """Find topology by version
34

35
    Returns a single topology # noqa: E501
36

37
    :param topology_id: ID of topology to return
38
    :type topology_id: int
39
    :param version: version of topology to return
40
    :type version: int
41

42
    :rtype: Topology
43
    """
44
    topology = current_app.te_manager.get_topology()
×
45
    converter = GrenmlConverter(topology)
×
46
    converter.read_topology()
×
47
    return converter.get_xml_str()
×
48

49

50
def topology_version(topology_id):  # noqa: E501
2✔
51
    """Finds topology version
52

53
    Topology version # noqa: E501
54

55
    :param topology_id: topology id
56
    :type topology_id: str
57

58
    :rtype: Topology
59
    """
60
    return "do some magic!"
2✔
61

62

63
def get_topology_domains():
2✔
NEW
64
    domain_dict = db_instance.get_value_from_db(
×
65
        MongoCollections.DOMAINS, Constants.DOMAIN_DICT
66
    )
NEW
67
    if not domain_dict:
×
68
        return []
×
69

NEW
70
    return domain_dict
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc