Skip to content

Commit

Permalink
Updates to IM, Fixes (#137)
Browse files Browse the repository at this point in the history
* Added storage descriptors in the IM, updated CP and VirtualLink to follow ETSI specifications
* Added ATD file for atomic entity, using new CP descriptor in FDU
* updated IM, using fog05-im modules for python APIs, code reorganization, cleanup, masking the calls to eval in order to make the code easy to read, new classes for FDU differentiated between users and infrastructure, LXD plugin uses new InfraFDU object for managing FDUs
* Updates and Fixs in Agent, FDU python classes and API
* updates in FDU objects and fixes on linuxbridge and linux plugin in order to solve #136
* updates to KVM and Native Plugin to use the new FDUs objects
* Initial implementation of Atomic Entity onboard and instantiation function on the agent
* updated APIs, Makefile, CLI to follow separation between FIM components and FAEM components

Signed-off-by: gabrik <gabriele.baldoni@gmail.com>
  • Loading branch information
gabrik committed Jul 31, 2019
1 parent 9d93142 commit 2a64389
Show file tree
Hide file tree
Showing 63 changed files with 4,563 additions and 2,256 deletions.
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ LINUX_PLUGIN_CONFFILE = /etc/fos/plugins/linux/linux_plugin.json

all:


make -C src/im/python
make -C src/im/ocaml install
make -C src/core/ocaml install
make -C src/api/ocaml/fimapi install
make -C src/api/ocaml/faemapi install
make -C src/agent/;

install:

make -C src/im/python install
make -C src/api/python/api install
# make -C src/api/ocaml/api install


ifeq "$(wildcard $(ETC_FOS_DIR))" ""
sudo mkdir -p /etc/fos/plugins
endif
Expand Down Expand Up @@ -73,7 +77,6 @@ lldp:
sudo systemctl stop lldpd

cli:
make -C src/api/ocaml/api install
make -C src/utils/ocaml/cli install

uninstall:
Expand All @@ -91,14 +94,15 @@ uninstall:
sudo rm -rf /etc/fos/agent
sudo rm -rf /usr/bin/fos_linux
sudo userdel fos
sudo pip3 uninstall fog05 -y
sudo pip3 uninstall fog05_im fog05 -y

clean:
opam remove fos-im -y
make -C src/im/ocaml clean
make -C src/core/ocaml clean
make -C src/agent clean
make -C src/api/ocaml/api clean
make -C src/api/ocaml/fimapi clean
make -C src/api/ocaml/faemapi clean
sudo rm -rf lldpd
sudo rm -rf src/pyhton/fog05.egg-info
sudo rm -rf src/pyhton/build
Expand Down
10 changes: 10 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@
- Plugins for Public/Private Clouds (AWS, Azure, GCP)/(OpenStack)
- Scaling Up/Down in runtime plugins (LXD, KVM, and clouds...)
- Web GUI for interaction







CHECK THIS FOR PYTHON USER API AND PYTHON PLUGIN API

https://github.com/5GCity/fog05/blob/meao_api_dev/mec/meao/meao_api/api.py
66 changes: 66 additions & 0 deletions examples/im/lxd_atomic_entity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"id": "one-fdu-atomic-entity",
"name": "test_atomic_entity",
"description": "this is a simple atomic entity composed by two LXD containers",
"fdus": [
{
"id": "alpine3.6",
"name": "alpine_3.6",
"computation_requirements": {
"cpu_arch": "x86_64",
"cpu_min_freq": 0.0,
"cpu_min_count": 1,
"ram_size_mb": 128.0,
"storage_size_gb": 5.0
},
"image": {
"uri": "lxd://alpine/3.6",
"checksum": "",
"format": ""
},
"hypervisor": "LXD",
"migration_kind": "LIVE",
"interfaces": [
{
"name": "eth0",
"is_mgmt": false,
"if_type": "INTERNAL",
"virtual_interface": {
"intf_type": "VIRTIO",
"vpci": "0:0:0",
"bandwidth": 10
},
"cp_id": "test-cp1"
}
],
"io_ports": [],
"connection_points": [
{
"id": "test-cp1",
"name": "test-internal-cp1",
}
],
"storage": [],
"depends_on": []
}
],
"internal_virtual_links": [
{
"id": "internal",
"name": "internal-vl",
"ip_configuration": {
"ip_version": "IPV4",
"subnet": "192.168.234.0/24",
"gateway": "192.168.234.1",
"dhcp_enable": true,
"dhcp_range": "192.168.234.2,192.168.234.100",
"dns": "8.8.8.8,8.8.4.4"
},
"int_cps": [
"test-cp1"
]
}
],
"connection_points": [],
"depends_on": []
}
21 changes: 11 additions & 10 deletions examples/im/lxd_fdu.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
{
"uuid": "1e57bb0e-cb41-4b23-bca3-1fa761a83c02",
"name": "test",
"id": "lxd-example-fdu",
"name": "example_fdu",
"computation_requirements": {
"cpu_arch": "x86_64",
"cpu_min_freq": 0.0,
"cpu_min_freq": 0,
"cpu_min_count": 1,
"ram_size_mb": 128.0,
"storage_size_gb": 10.0
},
"base_image": {
"uri": "file:///home/ubuntu/alpine.tar.gz",
"checksum": "21f436639dda7941a26d1eb0c5427862fd19910b",
"format": "tar.gz"
"uri": "lxd://alpine/3.6",
"checksum": "",
"format": ""
},
"hypervisor": "LXD",
"migration_kind": "LIVE",
"interfaces": [
{
"name": "eth0",
"is_mgmt": false,
"is_mgmt": true,
"if_type": "INTERNAL",
"mac_address": "be:ef:be:ef:00:01",
"virtual_interface": {
"intf_type": "VIRTIO",
"vpci": "0:0:0",
"bandwidth": 10
},
"cp_id": "2192bb19-a3f7-4b59-9473-eeec9573fb3b"
"cp_id": "test-cp1"
}
],
"io_ports": [],
"storage": [],
"connection_points": [
{
"uuid": "2192bb19-a3f7-4b59-9473-eeec9573fb3b",
"pair_id": "6cc2aa30-1dcf-4c93-a57e-433fd0bd498e"
"id": "test-cp1",
"name": "test-internal-cp1"
}
],
"depends_on": []
Expand Down
69 changes: 18 additions & 51 deletions fos-plugins/KVM/KVMFDU.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,75 +17,42 @@
import os
import json
from fog05.interfaces.States import State
from fog05.interfaces.FDU import FDU
from fog05.interfaces.InfraFDU import InfraFDU


class KVMFDU(FDU):
class KVMFDU(InfraFDU):

def __init__(self, uuid,fdu_uuid,node, status, accelerators, io_ports,
interfaces, connection_points, hypervisor_info):
super(KVMFDU, self).__init__()
self.uuid = uuid
self.fdu_uuid = fdu_uuid
self.node = node
self.status = status
self.accelerators = accelerators
self.io_ports = io_ports
self.interfaces = interfaces
self.cps = connection_points
self.hv_info = hypervisor_info
self.error_code = 0
self.error_msg = ''
self.migration_properties = None
self.image = None
self.comp_requirements = None
self.devices = None
self.conf = None
self.profiles = None
self.configuration = None
self.name = 'v{}'.format(uuid)
def __init__(self, data):
super(KVMFDU, self).__init__(data)
self.xml = None
self.cdrom = None
self.disk = None
self.name = 'v{}'.format(self.uuid)


@staticmethod
def from_record(record):
fdu = KVMFDU(record.get('uuid'),
record.get('fdu_uuid'),
record.get('node'),
record.get('status'),
record.get('accelerators'),
record.get('io_ports'),
record.get('interfaces'),
record.get('connection_points'),
record.get('hypervisor_info'))
return fdu

def on_define(self):
self.state = State.DEFINED
def on_defined(self):
self.set_status(State.DEFINED)

def on_configured(self, configuration):
self.xml = configuration
self.state = State.CONFIGURED
self.set_status(State.CONFIGURED)

def on_clean(self):
self.set_status(State.DEFINED)

def on_start(self):
self.state = State.RUNNING
self.set_status(State.RUNNING)

def on_stop(self):
self.state = State.CONFIGURED
self.set_status(State.CONFIGURED)

def on_pause(self):
self.state = State.PAUSED
self.set_status(State.PAUSED)

def on_resume(self):
self.state = State.RUNNING

def on_clean(self):
self.state = State.DEFINED
self.set_status(State.RUNNING)

def before_migrate(self):
pass

def after_migrate(self):
pass

def on_defined(self):
self.state = State.DEFINED
Loading

0 comments on commit 2a64389

Please sign in to comment.