Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
python-distem
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
myriads-team
python-distem
Commits
e0cf9031
Commit
e0cf9031
authored
Aug 21, 2019
by
Romain Olivo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pnode functions add
parent
cc8738a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
2 deletions
+78
-2
distem/__init__.py
distem/__init__.py
+78
-2
No files found.
distem/__init__.py
View file @
e0cf9031
...
...
@@ -10,13 +10,89 @@ class Distem:
self
.
port
=
port
self
.
client
=
requests
.
Session
()
def
pnode_init
(
target
=
"localhost"
,
desc
=
None
,
asynch
=
False
):
'''
Initialize a physical machine (launching daemon, creating cgroups, ...).
This step have to be performed to be able to create virtual nodes on a machine.
Args:
target (Str|List): target The hostname(s)/address(es)
of the physical node(n)
desc (dict): Hash structured as described in
:desc:`resources description<>`
asynch (bool): Asynchronious mode, check the physical node status
to know when the configuration is done (see {#pnode_info})
Returns:
dict of the physical node description
see :desc:`resources description <>`.
'''
if
desc
is
None
:
desc
=
{}
data
=
{
"target"
:
target
,
"desc"
:
desc
,
"async"
:
asynch
}
return
self
.
post_json
(
"/pnodes/"
,
data
=
data
)
def
pnode_quit
(
target
=
"localhost"
):
'''
Quit distem on a physical machine
Args:
target (str): The hostname/address of the physical node
Returns:
dict of the physical node description
see :desc:`resources description <>`.
'''
return
self
.
delete_json
(
"/pnodes/%s"
%
target
)
def
pnodes_quit
():
'''
# Retrieve informations about every physical nodes currently set on the platform
Returns:
list of physical node descriptions
see :desc:`resources description <>`.
'''
return
self
.
delete_json
(
"/pnodes"
)
def
pnode_info
(
target
=
"localhost"
):
'''
Retrieve informations about a physical node
Args:
target (str): The address/name of the physical node
Returns:
dict of the physical node description
see :desc:`resources description <>`.
'''
return
self
.
get_json
(
"/pnodes/%s"
%
target
)
def
pnodes_info
():
'''
Retrieve informations about every physical nodes
currently set on the platform
Returns:
list of physical node descriptions
see :desc:`resources description <>`.
'''
return
self
.
get_json
(
"/pnodes"
)
def
vnetwork_create
(
self
,
name
,
address
,
opts
=
None
):
"""
Create a new virtual network
Args:
name (str): The name of the virtual network (unique)
address(str) The
name (str): The name of the virtual network (unique)
addres (str): address in CIDR format (e.g 10.0.8.0/24)
opts (dict): used to store vxlan_id and number of PNODES
(should not be used directly)
...
...
@@ -30,7 +106,7 @@ class Distem:
return
self
.
post_json
(
"/vnetworks"
,
data
=
{
"name"
:
name
,
"address"
:
address
,
})
"address"
:
address
})
def
vnetwork_remove
(
self
,
vnetname
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment