Skip to content

Commit

Permalink
Merge with grixxly
Browse files Browse the repository at this point in the history
  • Loading branch information
aalonsog committed Nov 28, 2013
1 parent aa7555c commit df31c2e
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/JSTACK.Nova.Volume.js → src/JSTACK.Cinder.js
Expand Up @@ -22,11 +22,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */


// JStack Nova Volume Module // JStack Cinder Module
// ------------------ // ------------------


// Allows you to manage volumes and snapshots that can be used with the Compute API. // Allows you to manage volumes and snapshots that can be used with the Compute API.
JSTACK.Nova.Volume = (function (JS, undefined) { JSTACK.Cinder = (function (JS, undefined) {
"use strict"; "use strict";
var params, check, configure, getvolumelist, createvolume, deletevolume, getvolume, var params, check, configure, getvolumelist, createvolume, deletevolume, getvolume,
getsnapshotlist, createsnapshot, deletesnapshot, getsnapshot; getsnapshotlist, createsnapshot, deletesnapshot, getsnapshot;
Expand Down
230 changes: 227 additions & 3 deletions src/JSTACK.Neutron.js
Expand Up @@ -22,14 +22,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */


// JStack Neutron Module /// JStack Neutron Module
// ------------------ // ------------------


JSTACK.Neutron = (function(JS, undefined) { JSTACK.Neutron = (function(JS, undefined) {
"use strict"; "use strict";
var params, check, configure, getnetworkslist, createnetwork, updatenetwork, getnetworkdetail, deletenetwork, var params, check, configure, getnetworkslist, createnetwork, updatenetwork, getnetworkdetail, deletenetwork,
getsubnetslist, createsubnet, updatesubnet, getsubnetdetail, deletesubnet, getsubnetslist, createsubnet, updatesubnet, getsubnetdetail, deletesubnet,
getportslist, createport, updateport, getportdetail, deleteport; getportslist, createport, updateport, getportdetail, deleteport, getrouterslist, createrouter, updaterouter,
getrouterdetail, deleterouter, addinterfacetorouter, removeinterfacefromrouter;


// This modules stores the `url`to which it will send every // This modules stores the `url`to which it will send every
// request. // request.
Expand Down Expand Up @@ -604,6 +605,222 @@ JSTACK.Neutron = (function(JS, undefined) {
JS.Comm.del(url, JS.Keystone.params.token, onOK, onError); JS.Comm.del(url, JS.Keystone.params.token, onOK, onError);
}; };


getrouterslist = function(callback, error) {
var url, onOK, onError;
if (!check()) {
return;
}

url = params.url + 'v2.0/routers';

onOK = function(result) {
if (callback !== undefined) {
callback(result);
}
};
onError = function(message) {
if (error !== undefined) {
error(message);
}
};

JS.Comm.get(url, JS.Keystone.params.token, onOK, onError);
};

createrouter = function(name, admin_state_up, network_id, tenant_id, callback, error) {
var url, onOK, onError, data;
if (!check()) {
return;
}
url = params.url + 'v2.0/routers';

data = {
"router" : {
"external_gateway_info" : {
}
}
};

if (network_id !== undefined) {
data.router.external_gateway_info.network_id = network_id;
}

if (name !== undefined) {
data.router.name = name;
}

if (admin_state_up !== undefined) {
data.router.admin_state_up = admin_state_up;
}

if (tenant_id !== undefined) {
data.router.tenant_id = tenant_id;
}

onOK = function(result) {
if (callback !== undefined) {
callback(result);
}
};
onError = function(message) {
if (error !== undefined) {
error(message);
}
};

JS.Comm.post(url, data, JS.Keystone.params.token, onOK, onError);
};

getrouterdetail = function(router_id, callback, error) {
var url, onOK, onError;
if (!check()) {
return;
}
url = params.url + 'v2.0/routers/' + router_id;

onOK = function(result) {
if (callback !== undefined) {
callback(result);
}
};
onError = function(message) {
if (error !== undefined) {
error(message);
}
};

JS.Comm.get(url, JS.Keystone.params.token, onOK, onError);
};

updaterouter = function(router_id, network_id, name, admin_state_up, callback, error) {
var url, onOK, onError, data;
if (!check()) {
return;
}

url = params.url + 'v2.0/routers/' + router_id;

data = {
"router" : {
"external_gateway_info" : {
}
}
};

if (network_id !== undefined) {
data.router.external_gateway_info.network_id = network_id;
}

if (name !== undefined) {
data.router.name = name;
}

if (admin_state_up !== undefined) {
data.router.admin_state_up = admin_state_up;
}

onOK = function(result) {
if (callback !== undefined) {
callback(result);
}
};
onError = function(message) {
if (error !== undefined) {
error(message);
}
};

JS.Comm.put(url, data, JS.Keystone.params.token, onOK, onError);
};

deleterouter = function(router_id, callback, error) {
var url, onOK, onError;
if (!check()) {
return;
}
url = params.url + 'v2.0/routers/' + router_id;

onOK = function(result) {
if (callback !== undefined) {
callback(result);
}
};
onError = function(message) {
if (error !== undefined) {
error(message);
}
};

JS.Comm.del(url, JS.Keystone.params.token, onOK, onError);
};

addinterfacetorouter = function(router_id, subnet_id, port_id, callback, error) {
var url, onOK, onError, data;
if (!check()) {
return;
}
url = params.url + 'v2.0/routers/' + router_id + '/add_router_interface';

data = {

};

if (subnet_id !== undefined) {
data.subnet_id = subnet_id;
}

if (port_id !== undefined) {
data.port_id = port_id;
}

onOK = function(result) {
if (callback !== undefined) {
callback(result);
}
};
onError = function(message) {
if (error !== undefined) {
error(message);
}
};

JS.Comm.put(url, data, JS.Keystone.params.token, onOK, onError);
};

removeinterfacefromrouter = function(router_id, port_id, subnet_id, callback, error) {
var url, onOK, onError, data;
if (!check()) {
return;
}

data = {

};

url = params.url + 'v2.0/routers/' + router_id + '/remove_router_interface';

if (subnet_id !== undefined) {
data.subnet_id = subnet_id;
}

if (port_id !== undefined) {
data.port_id = port_id;
}

onOK = function(result) {
if (callback !== undefined) {
callback(result);
}
};
onError = function(message) {
if (error !== undefined) {
error(message);
}
};

JS.Comm.put(url, data, JS.Keystone.params.token, onOK, onError);
};

// Public Functions and Variables // Public Functions and Variables
// ------------------------------ // ------------------------------
// This is the list of available public functions and variables // This is the list of available public functions and variables
Expand All @@ -625,7 +842,14 @@ JSTACK.Neutron = (function(JS, undefined) {
getportdetail : getportdetail, getportdetail : getportdetail,
createport : createport, createport : createport,
updateport : updateport, updateport : updateport,
deleteport : deleteport deleteport : deleteport,
getrouterslist : getrouterslist,
createrouter : createrouter,
updaterouter : updaterouter,
getrouterdetail :getrouterdetail,
deleterouter : deleterouter,
addinterfacetorouter : addinterfacetorouter,
removeinterfacefromrouter : removeinterfacefromrouter
}; };


}(JSTACK)); }(JSTACK));
2 changes: 1 addition & 1 deletion tools/compile.sh
@@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash


java -jar compiler.jar --js ../src/JSTACK.js --js ../src/JSTACK.Comm.js --js ../src/JSTACK.Utils.js --js ../src/JSTACK.Keystone.js --js ../src/JSTACK.Nova.js --js ../src/JSTACK.Nova.Volume.js --js ../src/JSTACK.Glance.js --js_output_file ../release/jstack.js java -jar compiler.jar --js ../src/JSTACK.js --js ../src/JSTACK.Comm.js --js ../src/JSTACK.Utils.js --js ../src/JSTACK.Keystone.js --js ../src/JSTACK.Nova.js --js ../src/JSTACK.Cinder.js --js ../src/JSTACK.Glance.js --js ../src/JSTACK.Neutron.js --js_output_file ../release/jstack.js
4 changes: 2 additions & 2 deletions tools/compileDebug.sh
Expand Up @@ -6,6 +6,6 @@ cat ../src/JSTACK.Comm.js >> $OUTPUT
cat ../src/JSTACK.Utils.js >> $OUTPUT cat ../src/JSTACK.Utils.js >> $OUTPUT
cat ../src/JSTACK.Keystone.js >> $OUTPUT cat ../src/JSTACK.Keystone.js >> $OUTPUT
cat ../src/JSTACK.Nova.js >> $OUTPUT cat ../src/JSTACK.Nova.js >> $OUTPUT
cat ../src/JSTACK.Nova.Volume.js >> $OUTPUT cat ../src/JSTACK.Cinder.js >> $OUTPUT
cat ../src/JSTACK.Glance.js >> $OUTPUT cat ../src/JSTACK.Glance.js >> $OUTPUT
cat ../src/JSTACK.Neutron.js >> $OUTPUT cat ../src/JSTACK.Neutron.js >> $OUTPUT

0 comments on commit df31c2e

Please sign in to comment.