def valid_eventId(eventId): s = evtCfg.VALID_EVENT_STRING['eventId'] try: valid_string(eventId, s['allowed'], s['min_len'], s['max_len']) return True except Exception, e: msg = 'Invalid EiEvent Id [%s]; Reason: %s ' % (eventId, e) raise InvalidEiEventId(msg)
def valid_vtnComment(vtnComment): s = evtCfg.VALID_EVENT_STRING['vtnComment'] try: valid_string(vtnComment, s['allowed'], s['min_len'], s['max_len']) return True except Exception, e: msg = 'Invalid EiEvent VTN Comment [%s]; Reason: %s' % (vtnComment, e) raise InvalidEiEventVTNComment(msg)
def valid_venID(venID): s = evtCfg.VALID_EVENT_STRING['venID'] try: valid_string(venID, s['allowed'], s['min_len'], s['max_len']) return True except Exception, e: msg = 'Invalid VEN Id [%s]; Reason: %s' % (venID, e) raise InvalidEiEventVENId(msg)
def valid_signalName(signalName): s = evtCfg.VALID_EVENT_STRING['signalName'] try: valid_string(signalName, s['allowed'], s['min_len'], s['max_len']) return True except Exception, e: msg = 'Invalid EiEvent Signal Name [%s]; Reason: %s' % (signalName, e) raise InvalidEiEventSignalName(msg)
def valid_summary(summary): n = nodeCfg.VALID_NODE_STRING['summary'] try: valid_string(summary, n['allowed'], n['min_len'], n['max_len']) return True except Exception, e: msg = 'Invalid OADR Summary [%s]: Reason: %s' % \ (summary, e) raise InvalidOADRSummary(msg)
def valid_prefix(prefix): n = nodeCfg.VALID_NODE_STRING['prefix'] try: valid_string(prefix, n['allowed'], n['min_len'], n['max_len']) return True except Exception, e: msg = 'Invalid OADR URL Prefix [%s]; Reason: %s' % \ (prefix, e) raise InvalidOADRURLPrefix(msg)
def valid_node_id(nodeId): n = nodeCfg.VALID_NODE_STRING['nodeId'] try: valid_string(nodeId, n['allowed'], n['min_len'], n['max_len']) return True except Exception, e: msg = 'Invalid OADR Node Id [%s]; Reason: %s' % \ (nodeId, e) raise InvalidOADRNodeId(msg)