Skip to content

Commit

Permalink
Initial commit - Heat Translator for TOSCA templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mmnelemane committed Nov 14, 2016
1 parent 00501b7 commit d314a03
Show file tree
Hide file tree
Showing 16 changed files with 535 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bin/crowbar_tosca
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env ruby
#
# Copyright 2016, SUSE LINUX Products GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require File.join(File.expand_path(File.dirname(__FILE__)), "barclamp_lib")
@barclamp = "tosca"

main
21 changes: 21 additions & 0 deletions chef/cookbooks/tosca/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Cookbook Name:: opendaylight
# Attributes:: default
#
# Copyright 2016, SUSE LINUX Products GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

default[:tosca][:verbose] = true
default[:tosca][:debug] = true
24 changes: 24 additions & 0 deletions chef/cookbooks/tosca/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright 2016, SUSE LINUX Products GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

maintainer "Crowbar Project"
maintainer_email "crowbar@dell.com"
license "Apache 2.0"
description "TOSCA-Template parser and translator to HOT"
long_description ""
version "0.0.1"

recipe "tosca", "VNF Template parser for TOSCA-template and translator to HOT"
34 changes: 34 additions & 0 deletions chef/cookbooks/tosca/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Cookbook Name:: opendaylight
# Recipe:: default
#
# Copyright 2016, SUSE LINUX Products GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

if node[:platform_family] == "suse"

package "python-tosca-parser" do
owner "root"
group "root"
mode "0640"
end

package "openstack-heat-translator" do
owner "root"
group "root"
mode "0640"
end
end

17 changes: 17 additions & 0 deletions chef/cookbooks/tosca/recipes/role_tosca_parser.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright 2016, SUSE LINUX GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include_recipe "tosca::default"
107 changes: 107 additions & 0 deletions chef/cookbooks/tosca/templates/default/jetty.xml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//
DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">

<Configure class="org.eclipse.jetty.server.Server">

<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<!-- One of each type! -->
<!-- =========================================================== -->

<!-- Use this connector for many frequently idle connections and for
threadless continuations. -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host">
<Property name="jetty.host" />
</Set>
<Set name="port">
<Property name="jetty.port" default="8181" />
</Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8543</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host">
<Property name="jetty.host" />
</Set>
<Set name="port">
<Property name="jetty.port" default="<%= @port %>"/>
</Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>

<!-- =========================================================== -->
<!-- Configure Authentication Realms -->
<!-- Realms may be configured for the entire server here, or -->
<!-- they can be configured for a specific web app in a context -->
<!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
<!-- example). -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
<Set name="name">karaf</Set>
<Set name="loginModuleName">karaf</Set>
<Set name="roleClassNames">
<Array type="java.lang.String">
<Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
</Item>
</Array>
</Set>
</New>
</Arg>
</Call>
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
<Set name="name">default</Set>
<Set name="loginModuleName">karaf</Set>
<Set name="roleClassNames">
<Array type="java.lang.String">
<Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
</Item>
</Array>
</Set>
</New>
</Arg>
</Call>

</Configure>

34 changes: 34 additions & 0 deletions chef/data_bags/crowbar/template-tosca.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"id": "template-tosca",
"description": "TOSCA Templates for Virtual Network Functions",
"attributes": {
"tosca": {
"verbose" : true,
"debug" : true
}
},
"deployment": {
"tosca": {
"crowbar-revision": 0,
"crowbar-applied": false,
"schema-revision": 100,
"element_states": {
"tosca": [ "readying", "ready", "applying" ]
},
"elements": {},
"element_order": [
[ "tosca" ]
],
"element_run_list_order": {
"tosca": 81
},
"config": {
"environment": "tosca-config-base",
"mode": "full",
"transitions": false,
"transition_list": [
]
}
}
}
}
94 changes: 94 additions & 0 deletions chef/data_bags/crowbar/template-tosca.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"type": "map",
"required": true,
"mapping": {
"id": { "type": "str", "required": true, "pattern": "/^tosca-|^template-tosca$/" },
"description": { "type": "str", "required": true },
"attributes": {
"type": "map",
"required": true,
"mapping": {
"tosca": {
"type": "map",
"required": true,
"mapping": {
"verbose": { "type": "bool", "required": false },
"debug": { "type": "bool", "required": false }
}
}
}
},
"deployment": {
"type": "map",
"required": true,
"mapping": {
"tosca": {
"type": "map",
"required": true,
"mapping": {
"crowbar-revision": { "type": "int", "required": true },
"schema-revision": { "type": "int" },
"crowbar-committing": { "type": "bool" },
"crowbar-applied": { "type": "bool" },
"crowbar-status": { "type": "str" },
"crowbar-failed": { "type": "str" },
"crowbar-queued": { "type": "bool" },
"element_states": {
"type": "map",
"mapping": {
= : {
"type": "seq",
"required": true,
"sequence": [ { "type": "str" } ]
}
}
},
"elements": {
"type": "map",
"required": true,
"mapping": {
= : {
"type": "seq",
"required": true,
"sequence": [ { "type": "str" } ]
}
}
},
"element_order": {
"type": "seq",
"required": true,
"sequence": [ {
"type": "seq",
"sequence": [ { "type": "str" } ]
} ]
},
"element_run_list_order": {
"type": "map",
"required": false,
"mapping": {
= : {
"type": "int",
"required": true
}
}
},
"config": {
"type": "map",
"required": true,
"mapping": {
"environment": { "type": "str", "required": true },
"mode": { "type": "str", "required": true },
"transitions": { "type": "bool", "required": true },
"transition_list": {
"type": "seq",
"required": true,
"sequence": [ { "type": "str" } ]
}
}
}
}
}
}
}
}
}
6 changes: 6 additions & 0 deletions chef/roles/tosca-parser.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name "tosca-parser"
description "Tosca Role - Node registered as a TOSCA-template parser"
run_list("recipe[tosca::role_tosca_parser]")
default_attributes()
override_attributes()

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright 2016, SUSE LINUX GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Loading

0 comments on commit d314a03

Please sign in to comment.