def gen_cps_obj_status():
    if check_fault_state() == False:
        return
    cur_status = get_status_call()
    _obj = cps_object.CPSObject(module=STATUS_KEY, qual='observed')
    _obj.add_attr('status', cur_status)
    _obj.add_attr('node-id',get_node_id())
    for i in range(len(sensor_list)):
        _retDict = sys_status.get_sensor(sensor_list[i])
        if _retDict != None:
            _obj.add_embed_attr(['sensor', str(i), 'name'], sensor_map[sensor_list[i]])
            _obj.add_embed_attr(['sensor', str(i), 'value-type'], 2)
            if _retDict['fault-state'] != None:
                _obj.add_embed_attr(['sensor', str(i), 'fault-state'], _retDict['fault-state'])
            if _retDict['value'] != None:
                _obj.add_embed_attr(['sensor', str(i), 'value'], str(round(_retDict['value'], 2)))
            if _retDict['threshold'] != None:
                _obj.add_embed_attr(['sensor', str(i), 'threshold'], str(round(_retDict['threshold'],2)))
            if _retDict['description'] != None:
                _obj.add_embed_attr(['sensor', str(i), 'description'],_retDict['description'])
    obj = _obj.get()
    obj['operation'] = 'set'
    # publish to db
    ev.logging('SYS_STAT', ev.DEBUG, '', 'system_status_db.py', '', 0, 'Overall system status is %d' % cur_status)
    global overall_status
    if overall_status != cur_status:
        ev.logging('SYS_STAT', ev.DEBUG, '', 'system_status_db.py', '', 0, 'Overall system status change detected: %d to %d' % (overall_status, cur_status))
        overall_status = cur_status
        cps.db_commit(obj, None, True)
    else:
        cps.db_commit(obj, None, False)
Ejemplo n.º 2
0
def log_err(msg):
    ev.logging("BASE_VRF",ev.ERR,"VRF-CONFIG","","",0,msg)
Ejemplo n.º 3
0
def log_info(msg):
    ev.logging("BASE_IP",ev.INFO,"IPSEC-CONFIG-UTILS","","",0,msg)
Ejemplo n.º 4
0
def log_err(msg):
    ev.logging("BASE_IP",ev.ERR,"IPSEC-CONFIG-UTILS","","",0,msg)
Ejemplo n.º 5
0
def log_msg(level, msg, func_name, line_num):
    ev.logging("CPS_CONNECTIVITY", level, "CONNECTIVITY_AGENT", log_filename,
               func_name, line_num, msg)
Ejemplo n.º 6
0
def log_info(msg):
    ev.logging("INTERFACE",ev.INFO,"INTERFACE-HANDLER","","",0,msg)
Ejemplo n.º 7
0
def log_err(msg):
    ev.logging("INTERFACE",ev.ERR,"INTERFACE-HANDLER","","",0,msg)
Ejemplo n.º 8
0
def _log_print(log, msg):
    if log == None:
        print msg
    else:
        ev.logging("DSAPI", log, "", "", "", 0, msg)
Ejemplo n.º 9
0
def log_info(msg):
    ev.logging("BASE_MCAST_SNOOP", ev.INFO, "MCAST_UTILS", "", "", 0, msg)
Ejemplo n.º 10
0
def log_debug(msg):
    ev.logging("BASE_MCAST_SNOOP", ev.DEBUG, "MCAST_UTILS", "", "", 0, msg)
Ejemplo n.º 11
0
def log_err(msg):
    ev.logging("BASE_MCAST_SNOOP", ev.ERR, "MCAST_UTILS", "", "", 0, msg)
Ejemplo n.º 12
0
def log_info(msg):
    ev.logging("BASE_IP", ev.INFO, "IP-CONFIG", "", "", 0, msg)
Ejemplo n.º 13
0
def log_err(msg):
    ev.logging("BASE_IP", ev.ERR, "IP-CONFIG", "", "", 0, msg)
Ejemplo n.º 14
0
def log_info(msg):
    ev.logging("BASE_VRF",ev.INFO,"VRF-CONFIG","","",0,msg)
def log_msg(level, msg):
    ev.logging("DSAPI", level, "DB-TUNNEL-MANAGER", "", "", 0, msg)
Ejemplo n.º 16
0
    cps_utils.add_attr_type("igmp-mld-snooping/rt/routing/control-plane-protocols/mld-snooping/vlans/vlan/static-l2-multicast-group/source-addr", "string")

if __name__ == '__main__':

    shutdown = False

    # Install signal handlers.
    signal.signal(signal.SIGTERM, sigterm_hdlr)

    # Notify systemd: Daemon is ready
    systemd.daemon.notify("READY=1")

    #if file exists means kernel snooping is not needed and some snooping
    #application might be running
    if mcast_os.path.isfile(snoop_cfg_file) is True:
        ev.logging("BASE_MCAST_SNOOP",ev.DEBUG,"MCAST_SVC","","",0,"Kernel IGMP/MLD snooping not needed")
        kernel_snooping_needed = False

    # Wait for interface service being ready
    interface_key = cps.key_from_name('target', 'dell-base-if-cmn/if/interfaces/interface')

    ev.logging("BASE_MCAST_SNOOP",ev.DEBUG,"MCAST_SVC","","",0,"Wait for interface object to be ready")
    while cps.enabled(interface_key) == False:
        time.sleep(1)

    ev.logging("BASE_MCAST_SNOOP",ev.DEBUG,"MCAST_SVC","","",0,"Interface object ready")

    # Few IP address attributes are in binaries, these ip address are treated as string type.
    _mcast_set_attr_type()

    handle = cps.obj_init()
def log_msg(level,msg):
    ev.logging("DSAPI",level,"DB-INSTANCE-MANAGER","","",0,msg)