mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 09:17:08 +00:00
Return current environmental data in JSON
This commit is contained in:
@@ -15,6 +15,7 @@ import os
|
||||
import re
|
||||
import yaml
|
||||
import onl.YamlUtils
|
||||
import subprocess
|
||||
|
||||
class OnlInfoObject(object):
|
||||
DEFAULT_INDENT=" "
|
||||
@@ -256,6 +257,11 @@ class OnlPlatformBase(object):
|
||||
# is ma1 and lo
|
||||
return 2
|
||||
|
||||
def environment(self):
|
||||
yamlstr = subprocess.check_output(['/bin/onlpd', '-r', '-y'])
|
||||
data = yaml.load(yamlstr);
|
||||
return json.dumps(data, indent=4)
|
||||
|
||||
def __str__(self):
|
||||
s = """Model: %s
|
||||
Manufacturer: %s
|
||||
|
||||
Reference in New Issue
Block a user