nuagenetworks / monolithe Goto Github PK
View Code? Open in Web Editor NEWgeneric and extendable code generator from specifications.
License: BSD 3-Clause "New" or "Revised" License
generic and extendable code generator from specifications.
License: BSD 3-Clause "New" or "Revised" License
It would be nice instead of assuming that creationDate, owner etc are default bambou attributes, we could create a specification that is inherited.
I suggest that we could add some specifications prefixed by a symbol
@vsdobject.spec
The repo parsers would ignore those prefixed specifications when building the object model.
Then in standard specifications we could add in the model
section an attribute extends: vsdobject
When a parser gets a spec, it would look for this token, then fetch the inherited specification, in order to correctly compute the Specification object.
It should also not difficult to allow multiple inheritence.
subnet.spec extends @vsdobject.spec extends @restobject.spec
Clean environment with only basic python-pip installed, running the following commands to install vspk:
mkdir GitHub
cd GitHub
git clone https://github.com/nuagenetworks/vspkgenerator.git
git clone https://github.com/nuagenetworks/vsd-api-specifications.git
git clone https://github.com/nuagenetworks/bambou.git
git clone https://github.com/nuagenetworks/monolithe.git
cd bambou/
pyhton setup.py install
cd ../monolithe
python setup.py install
cd ../vspkgenerator
python setup.py install
cd ..
generate-vspk -b 3.2 -f vsd-api-specifications
cd codegen
python setup.py install
When executing the following code:
from vspk import v3_2 as vsdk
nc = vsdk.NUVSDSession(username='csproot', password='csproot', enterprise='csp', api_url="https://10.167.43.48:8443")
nc.start()
Results in the following exception thrown (output from inside ipython):
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-17836de9e772> in <module>()
----> 1 nc.start()
/usr/lib/python2.7/site-packages/bambou-2.0.0-py2.7.egg/bambou/nurest_session.pyc in start(self)
169 else:
170 _NURESTSessionCurrentContext.session = self
--> 171 self._authenticate()
172 return self
173
/usr/lib/python2.7/site-packages/bambou-2.0.0-py2.7.egg/bambou/nurest_session.pyc in _authenticate(self)
138
139 if self._root_object is None:
--> 140 self._root_object = self.create_root_object()
141 self._root_object.fetch()
142
/usr/lib/python2.7/site-packages/vspk-3.2.4-py2.7.egg/vspk/v3_2/nuvsdsession.pyc in create_root_object(self)
76
77 """
---> 78 return NUMe()
79
80
/usr/lib/python2.7/site-packages/vspk-3.2.4-py2.7.egg/vspk/v3_2/nume.pyc in __init__(self, **kwargs)
279
280
--> 281 self.vsps = NUVSPsFetcher.fetcher_with_object(parent_object=self, relationship="root")
282
283
TypeError: fetcher_with_object() got an unexpected keyword argument 'relationship'
When I tried to run
./examples/demo-client.py
I got
Traceback (most recent call last):
File "/home/jennings/.local/lib/python2.7/site-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/home/jennings/.local/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/home/jennings/.local/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/jennings/.local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/jennings/.local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/jennings/.local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/jennings/.local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/jennings/.local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/jennings/test-dev/monolithe/examples/demo-server.py", line 21, in get_lists
if not lib.check_auth(request):
File "/home/jennings/test-dev/monolithe/examples/minilib/lib.py", line 13, in check_auth
decoded_auth = base64.urlsafe_b64decode(str(encoded_auth))
File "/usr/lib/python2.7/base64.py", line 119, in urlsafe_b64decode
"""
File "/home/jennings/.local/lib/python2.7/site-packages/future/types/newstr.py", line 390, in translate
if ord(c) in table:
TypeError: 'in ' requires string as left operand, not int
And all seem to go back to normal after deleting the from builtins import *
lines in example/minilib/lib.py
& example/minilib/data.py
.
As reported in vspk-go nuagenetworks/vspk-go#5, some models have an interface which contains an attribute of type int
. Those attributes should not be omitted if empty (omitempty) as golang considers 0 an empty value.
I am working on a PR to fix this.
Add a -o option to support the X-Nuage-OrderBy header for VSD CLI
Is there a reason why the data type "time" is mapped to Float
(instead of Long
)?
This creates an issue when trying to set the startDateTime
attribute from the ScheduledTestSuite
object.
http://nuagenetworks.github.io/vsd-api-documentation/v6/20.10.8/scheduledtestsuite.html#attr_startDateTime
When installing all the components from the GitHub repositories (clone bambou, monolithe, vspkgenerator and vsd-api-specifications, pyton setup.py install for bambou, monolithe, vspkgenerator) and using the vspkgenerator fails:
# generate-vspk -f /root/GitHub/vsd-api-specifications -b 3.2
[log] retrieving specifications from folder "/root/GitHub/vsd-api-specifications"
[log] 130 specifications retrieved from folder "/root/GitHub/vsd-api-specifications" (api version: 3.2)
Traceback (most recent call last):
File "/bin/monogen-sdk", line 9, in <module>
load_entry_point('monolithe==1.0.0', 'console_scripts', 'monogen-sdk')()
File "/usr/lib/python2.7/site-packages/monolithe-1.0.0-py2.7.egg/monolithe/generators/sdk/cli.py", line 146, in main
generator.generate_from_folder()
File "/usr/lib/python2.7/site-packages/monolithe-1.0.0-py2.7.egg/monolithe/generators/lib/generator.py", line 68, in generate_from_folder
self.generate(specification_info=specification_info)
File "/usr/lib/python2.7/site-packages/monolithe-1.0.0-py2.7.egg/monolithe/generators/sdk/sdkgenerator.py", line 68, in generate
self.install_system_vanilla(current_file=__file__, output_path=sdk_output)
File "/usr/lib/python2.7/site-packages/monolithe-1.0.0-py2.7.egg/monolithe/generators/lib/generator.py", line 121, in install_system_vanilla
shutil.copytree(system_vanilla_path, output_path)
File "/usr/lib64/python2.7/shutil.py", line 171, in copytree
names = os.listdir(src)
OSError: [Errno 2] No such file or directory: '/usr/lib/python2.7/site-packages/monolithe-1.0.0-py2.7.egg/monolithe/generators/sdk/python/vanilla'
The source of the error is the change in the monolithe/generators/sdk
folder which is not reflected in the MANIFEST.in file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.