Example #1
0
 def __init__(self,
              entities_yml_file=config.cfg.entities_yml_file,
              *args,
              **kwargs):
     self.entities_yml_file = entities_yml_file
     self.entities = util.read_data_file(self.entities_yml_file)
     self.users = util.myDict(self.getUsers())
     self.devices = util.myDict(self.getDevices())
Example #2
0
def oid_by_name(name=None, oids_yml_file=config.cfg.oids_yml_file):
    """Given an OID name, return the OID string and the oids_dict in a tuple.

    Parameter:: name
    Parameter_type:: string
    Return:: return_val
    Return_type:: tuple (string, dict)

    Prints an error to stdout if 'name' paramter does not match a key
    in oids_dict.
    """

    oids_dict = util.read_data_file(oids_yml_file)

    return_val = oids_dict.get(name)
    if return_val[0] == None:
        print "Error: Parameter value of parameter 'name' did not match a key in oids_dict.  'name' = ", name
        print "  Valid keys in oids_dict:"
        print "  ", oids_dict.keys()
    return return_val
Example #3
0
def oid_by_name(name=None, oids_yml_file=config.cfg.oids_yml_file):
    """Given an OID name, return the OID string and the oids_dict in a tuple.

    Parameter:: name
    Parameter_type:: string
    Return:: return_val
    Return_type:: tuple (string, dict)

    Prints an error to stdout if 'name' paramter does not match a key
    in oids_dict.
    """

    oids_dict = util.read_data_file(oids_yml_file)

    return_val = oids_dict.get(name)
    if return_val[0] == None:
        print "Error: Parameter value of parameter 'name' did not match a key in oids_dict.  'name' = ", name
        print "  Valid keys in oids_dict:"
        print "  ", oids_dict.keys()
    return return_val
Example #4
0
 def __init__(self, entities_yml_file=config.cfg.entities_yml_file, *args, **kwargs):
     self.entities_yml_file = entities_yml_file
     self.entities = util.read_data_file(self.entities_yml_file)
     self.users = util.myDict(self.getUsers())
     self.devices = util.myDict(self.getDevices())
Example #5
0
def get_file_data(file_name):
    file_data_dict = read_data_file(file_name)
    return file_data_dict