add setDirtyModels/listDirtyModels support to xossh
Change-Id: Iabe56814b6996e4582ea081fa620e9cdc87959f9
diff --git a/xos/tools/xossh b/xos/tools/xossh
new file mode 100755
index 0000000..e71b5f7
--- /dev/null
+++ b/xos/tools/xossh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# This is a stub for launching xossh in the xosproject/xos-client container
+
+docker run -it -v /opt/cord_profile/im_cert_chain.pem:/usr/local/share/ca-certificates/local_certs.crt xosproject/xos-client:candidate -u xosadmin@opencord.org -p `cat /opt/cord/build/platform-install/credentials/xosadmin@opencord.org`
\ No newline at end of file
diff --git a/xos/xos_client/xosapi/orm.py b/xos/xos_client/xosapi/orm.py
index 3daed94..12e658f 100644
--- a/xos/xos_client/xosapi/orm.py
+++ b/xos/xos_client/xosapi/orm.py
@@ -392,9 +392,6 @@
model = getattr(self, model_name)
return model.objects.get(id=id)
- def listObjects(self):
- return self.all_model_names
-
def add_default_metadata(self, metadata):
default_metadata = [ ("caller_kind", self.caller_kind) ]
@@ -438,6 +435,9 @@
def make_Query(self):
return _sym_db._classes["xos.Query"]()
+ def listObjects(self):
+ return self.all_model_names
+
def register_convenience_wrapper(class_name, wrapper):
global convenience_wrappers
diff --git a/xos/xos_client/xossh b/xos/xos_client/xossh
old mode 100755
new mode 100644
index 7e3fe58..8a480d3
--- a/xos/xos_client/xossh
+++ b/xos/xos_client/xossh
@@ -11,7 +11,7 @@
import rlcompleter
from twisted.internet import reactor
-from xosapi.xos_grpc_client import InsecureClient, SecureClient, setup_logging
+from xosapi.xos_grpc_client import InsecureClient, SecureClient, setup_logging, Empty
current_client = None
@@ -103,6 +103,20 @@
client.set_reconnect_callback(functools.partial(start_xossh, client))
client.start()
+def setDirtyModels(*args, **kwargs):
+ return current_client.utility.SetDirtyModels(current_client.utility_pb2.ModelFilter(*args, **kwargs))
+
+def listDirtyModels(*args, **kwargs):
+ return current_client.utility.ListDirtyModels(current_client.utility_pb2.ModelFilter(*args, **kwargs))
+
+def listModelDefs():
+ return current_client.modeldefs.ListModelDefs(Empty())
+
+def listUtility():
+ print 'setDirtyModels(class_name=None)'
+ print 'listDirtyModels(class_name=None)'
+ print 'listModelDefs()'
+
def examples():
print 'coreapi.Slice.objects.all() # list all slices'
print 's = Slice.objects.new() # create a new slice'
@@ -131,6 +145,7 @@
print "XOS Core server at %s" % client.endpoint
print 'Type "listObjects()" for a list of all objects'
+ print 'Type "listUtility()" for a list of utility functions'
print 'Type "login("username", "password")" to switch to a secure shell'
print 'Type "examples()" for some examples'