5 This charm layer is intended for use by vendors who wish to integrate with
6 OSM. The current release of OSM only supports a lightweight version of Juju
7 charms, which we will refer to as "proxy charms". Consider the diagram below:
10 +---------------------+ +---------------------+
12 | Resource | | Service |
13 | Orchestrator (RO) +----> Orchestrator (SO) |
15 +------------------+--+ +-------+----^--------+
19 +-----v-----+ +-v----+--+
24 +-----------+ +---------+
27 The Virtual Machine (VM) is created by the Resource Orchestrator (RO), at the
28 request of the Service Orchestrator (SO). Once the VM has been created, a
29 "proxy charm" is deployed in order to facilitate operations between the SO and
30 your service running within the VM.
32 As such, a proxy charm will expose a number of "actions" that are run via the
33 SO. By default, the following actions are exposed:
44 Some actions, such as `run` and `reboot`, do not require any additional configuration. `start`, `stop` and `restart`, however, will require you to
45 implement the command(s) required to interact with your service.
49 Create the framework for your proxy charm:
52 $ charm create pingpong
56 Modify `layer.yaml` to the following:
63 The `metadata.yaml` describes your service. It should look similar to the following:
67 summary: A layer for developing OSM "proxy" charms.
68 maintainer: Adam Israel <adam.israel@canonical.com>
70 VNF "proxy" charms are a lightweight version of a charm that, rather than
71 installing software on the same machine, execute commands over an ssh channel.
81 Implement the default action(s) you wish to support by adding the following code to reactive/pingpong.py and fill in the cmd to be run:
84 @when('actions.start')
89 result, err = charms.sshproxy._run(cmd)
91 action_fail('command failed:' + err)
93 action_set({'outout': result})
95 remove_flag('actions.start')
102 # Enter the command to stop your service(s)
103 cmd = "service myname stop"
104 result, err = charms.sshproxy._run(cmd)
106 action_fail('command failed:' + err)
108 action_set({'outout': result})
110 remove_flag('actions.stop')
113 @when('actions.restart')
117 # Enter the command to restart your service(s)
118 cmd = "service myname restart"
119 result, err = charms.sshproxy._run(cmd)
121 action_fail('command failed:' + err)
123 action_set({'outout': result})
125 remove_flag('actions.restart')
128 Rename `README.ex` to `README.md` and describe your application and its usage.
130 -- fix this. there are cases where the config is useful -- Delete `config.yaml`, since the charm's configuration will be driven by the SO.
132 Create the `actions.yaml` file; this will describe the additional operations you would like to perform on or against your service.
136 description: "Set the target IP address and port"
139 description: "IP on which the target service is listening."
143 description: "Port on which the target service is listening."
149 description: "Set the rate of packet generation."
152 description: "Packet rate."
156 description: "Get the stats."
158 description: "Get the admin state of the target service."
160 description: "Get the rate set on the target service."
162 description: "Get the target server and IP set"
166 Once you've implemented your actions, you need to compile the various charm layers: