Skip to content

Commit

Permalink
TOSCA visualizer
Browse files Browse the repository at this point in the history
Also update vendor library versions
  • Loading branch information
tliron committed Oct 2, 2018
1 parent 4423883 commit 3918aa9
Show file tree
Hide file tree
Showing 10 changed files with 672 additions and 32 deletions.
14 changes: 7 additions & 7 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
name = "github.com/beevik/etree"
version = "1.0.1"

[[constraint]]
branch = "master"
name = "github.com/dop251/goja"
Expand All @@ -14,6 +45,10 @@
name = "github.com/op/go-logging"
version = "1.0.0"

[[constraint]]
name = "github.com/segmentio/ksuid"
version = "1.0.1"

[[constraint]]
name = "github.com/spf13/cobra"
version = "0.0.3"
Expand Down
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Deliberately stateless cloud topology management and deployment tools based on

Impatient? Check out the [quickstart guide](QUICKSTART.md).

Developer? Check out the [development guide](scripts/README.md).
Developer! Please check out the [development guide](scripts/README.md).

puccini-tosca
-------------
Expand All @@ -30,10 +30,9 @@ These include node, capability, relationship, policy, and other types, as well a
JavaScript code to provide orchestration integrations.
Also included are detailed [examples](examples/README.md) using these profiles to get you started.

We support
[CSAR files](http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.1/os/TOSCA-Simple-Profile-YAML-v1.1-os.html#_Toc489606742)
(TOSCA packages) in addition to YAML files. We're even including a simple CSAR creation tool,
**puccini-csar**.
TOSCA in YAML is supported, as well as packaged
[CSAR files](http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.1/os/TOSCA-Simple-Profile-YAML-v1.1-os.html#_Toc489606742).
We're even including a simple CSAR creation tool, **puccini-csar**.

How do TOSCA, Clout, JavaScript, and cloud infrastructures all fit together in Puccini? Consider
this: with a single command line you can take a TOSCA service template, compile it with
Expand Down Expand Up @@ -64,15 +63,22 @@ The TOSCA-to-Clout compiler just takes the parsed data structure and dumps it in
includes any JavaScript required to process the Clout. Thusly Clout functions as an "intermediate
representation" (IR) for TOSCA.

### Visualiztion

You can graphically visualize the compiled TOSCA in a dynamic web page via the embedded
**tosca.visualize** JavaScript. A one-line example:

puccini-tosca compile my-app.yaml | puccini-js exec tosca.visualize > /tmp/my-app.html && xdg-open /tmp/my-app.html

* [**puccini-tosca** documentation](puccini-tosca/README.md)
* [TOSCA parser documentation](tosca/parser/README.md)

puccini-js
----------

Clout processor for JavaScript. Executes existing JavaScript in a Clout file. For example, it can
execute the Kubernetes spec generation code inserted by **puccini-tosca**. It also supports
executing intrinsic functions and value constraints (for example, TOSCA's).
execute the Kubernetes spec generation code inserted by **puccini-tosca**, as well as TOSCA
intrinsic functions and value constraints.

Also supported are implementation-specific JavaScript "plugins" that allow you to extend existing
functionality. For example, you can add a plugin for Kubernetes to handle custom application needs,
Expand All @@ -83,7 +89,7 @@ permanently or piping through to add and execute them on-the-fly.
### TOSCA Intrinsic Functions and Constraints

These are implemented in JavaScript so that they can be put into the Clout and then be executed
by **puccini-js**, allowing a compiled-from-TOSCA Clout file to be entirely independent from TOSCA.
by **puccini-js**, allowing a compiled-from-TOSCA Clout file to be entirely independent of TOSCA.
The Clout lives on its own.

To call these functions we provide the **tosca.coerce** JavaScript, which calls all functions and
Expand Down
16 changes: 8 additions & 8 deletions assets/tosca/profiles/simple/1.1/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ tosca.traverseValues = function(traverser) {
vertex = clout.vertexes[v];
if (tosca.isNodeTemplate(vertex)) {
nodeTemplate = vertex.properties;

tosca.traverseObjectValues(traverser, nodeTemplate.properties, vertex);
tosca.traverseObjectValues(traverser, nodeTemplate.attributes, vertex);
tosca.traverseInterfaceValues(traverser, nodeTemplate.interfaces, vertex)

for (c in nodeTemplate.capabilities) {
capability = nodeTemplate.capabilities[c];
tosca.traverseObjectValues(traverser, capability.properties, vertex);
tosca.traverseObjectValues(traverser, capability.attributes, vertex);
}

for (a in nodeTemplate.artifacts) {
artifact = nodeTemplate.artifacts[a];
tosca.traverseObjectValues(traverser, artifact.properties, vertex);
}

for (e in vertex.edgesOut) {
edge = vertex.edgesOut[e];
if (!tosca.isTosca(edge, 'relationship'))
Expand All @@ -60,10 +60,10 @@ tosca.traverseValues = function(traverser) {

tosca.traverseInterfaceValues = function(interfaces, site, source, target) {
for (i in interfaces) {
intr = interfaces[i];
tosca.traverseObjectValues(traverser, intr.inputs, site, source, target);
for (o in intr.operations)
tosca.traverseObjectValues(traverser, intr.operations[o].Inputs, site, source, target);
interface_ = interfaces[i];
tosca.traverseObjectValues(traverser, interface_.inputs, site, source, target);
for (o in interface_.operations)
tosca.traverseObjectValues(traverser, interface_.operations[o].Inputs, site, source, target);
}
};

Expand Down
Loading

0 comments on commit 3918aa9

Please sign in to comment.