import json


def get_node_to_srn_mapping(match_config_filename):
    
    """
    Returns the node-to-srn map from match_conf.json
    """
    
    with open(match_config_filename) as config_file:
        config_json = json.loads(config_file.read())

    if "node_to_srn_mapping" in config_json:
        return config_json["node_to_srn_mapping"]

    else:
        node_to_srn = {}
        for node_info in config_json["NodeData"]:
            node_id = node_info["TrafficNode"]
            srn_num = node_info["srn_number"]
            node_to_srn[node_id] = srn_num
        
        return node_to_srn