Beispiel #1
0
def main(database=None, config_file=None, mdl_file=None, constraints=None):
    """
    Connects to OrientDB database, discovers the 'TxOp' Children of 'RadioLinks', and modifies the start and end times
    :param (str) database: the name of the OrientDB database
    :param (str) config_file: path to the config file for OrientDB
    :return:
    """
    print(
        '****************       Calling and Restting OrientDB         ****************'
    )

    mdl_full_path = os.path.abspath(mdl_file)
    importer = MDLImporter(database, mdl_full_path, config_file)
    importer.import_xml()

    processor = BrassOrientDBHelper(database, config_file)
    processor.open_database(over_write=False)
    reset_orientdb_central_fq(processor)

    TxOp_nodes = processor.get_nodes_by_type('TxOp')
    # Brass process of applying constraints happens here
    updated_frequency = 4943000000
    new_fqhz = condition_str('CenterFrequencyHz', str(updated_frequency), '=')
    print(new_fqhz)

    TxOp_nodes = processor.get_nodes_by_type('TxOp')
    RANConfiguration_nodes = processor.get_nodes_by_type('RANConfiguration')
    for txop_node in TxOp_nodes:
        print(txop_node)
        print(
            '****************       Updating TxOp Node {0}         ****************'
            .format(txop_node._rid))
        processor.update_node(txop_node._rid, new_fqhz)

    for ran_node in RANConfiguration_nodes:
        print(ran_node)
        print(
            '****************       Updating RANConfiguration Node {0}         ****************'
            .format(ran_node._rid))
        processor.update_node(ran_node._rid, new_fqhz)

    # print('Post Modification')
    # TxOp_nodes = processor.get_nodes_by_type('TxOp')
    # RANConfiguration_nodes = processor.get_nodes_by_type('RANConfiguration')
    #
    # for txop_node in TxOp_nodes:
    #     print(txop_node)
    #
    # for ran_node in RANConfiguration_nodes:
    #     print(ran_node)

    processor.close_database()
    export = MDLExporter(database, "Scenario_2_Export.xml", config_file)
    export.export_xml()
Beispiel #2
0
def main(database=None, config_file=None):
    """
    Connects to OrientDB database, discovers the 'TxOp' Children of 'RadioLinks', and modifies the start and end times
    :param (str) database: the name of the OrientDB database
    :param (str) config_file: path to the config file for OrientDB
    :return:
    """
    print(
        '****************       Update RadioLink Schedule         ****************'
    )

    processor = BrassOrientDBHelper(database, config_file)
    processor.open_database(over_write=False)

    select_radio = sql.select_sql('RadioLink')
    RadioLink_nodes = processor.run_query(select_radio)
    for node in RadioLink_nodes:
        print('>>>>>>> {0} : {1}'.format(node._rid, node.Name))
        printOrientRecord(node)
    select_radio = '(' + select_radio + ')'
    traverse_radio = sql.traverse_sql(select_radio,
                                      direction='in',
                                      edgetype='Containment')
    TxOp_conditional = sql.condition_str(lh='class', rh='TxOp', op='=')
    TxOp_select = sql.select_sql(traverse_radio, [TxOp_conditional])
    TxOp_nodes = processor.run_query(TxOp_select)

    # TxOp_nodes = processor.get_nodes_by_type('TxOp')

    for node in TxOp_nodes:
        print(node)
        new_startusec = sql.condition_str('StartUSec',
                                          str(int(node.StartUSec) + 105), '=')
        new_stopusec = sql.condition_str('StopUSec',
                                         str(int(node.StopUSec) + 105), '=')
        processor.update_node(node._rid, new_startusec, new_stopusec)
    print('Post Modification')
    TxOp_nodes = processor.get_nodes_by_type('TxOp')

    for node in TxOp_nodes:
        print(node)
    processor.close_database()