omf_sfa 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +24 -0
- data/Gemfile +6 -0
- data/README.md +211 -0
- data/Rakefile +23 -0
- data/bin/parse_rspec.rb +167 -0
- data/etc/omf-sfa/omf-sfa-am.yaml +12 -0
- data/examples/exogeni5nodemanifest.rspec +105 -0
- data/examples/instageni5nodemanifest.rspec +150 -0
- data/lib/omf-sfa/am/am-rest/REST_API.md +301 -0
- data/lib/omf-sfa/am/am-rest/account_handler.rb +145 -0
- data/lib/omf-sfa/am/am-rest/am_rest_server.rb +255 -0
- data/lib/omf-sfa/am/am-rest/api_template.html +48 -0
- data/lib/omf-sfa/am/am-rest/config.ru +110 -0
- data/lib/omf-sfa/am/am-rest/resource_handler.rb +178 -0
- data/lib/omf-sfa/am/am-rest/rest_handler.rb +573 -0
- data/lib/omf-sfa/am/am-rest/session_authenticator.rb +130 -0
- data/lib/omf-sfa/am/am-rpc/abstract_rpc_service.rb +60 -0
- data/lib/omf-sfa/am/am-rpc/am_authorizer.rb +161 -0
- data/lib/omf-sfa/am/am-rpc/am_rpc_api.rb +450 -0
- data/lib/omf-sfa/am/am-rpc/am_rpc_service.rb +402 -0
- data/lib/omf-sfa/am/am_liaison.rb +93 -0
- data/lib/omf-sfa/am/am_manager.rb +859 -0
- data/lib/omf-sfa/am/am_runner.rb +108 -0
- data/lib/omf-sfa/am/am_scheduler.rb +146 -0
- data/lib/omf-sfa/am/am_server.rb +194 -0
- data/lib/omf-sfa/am/config.ru +122 -0
- data/lib/omf-sfa/am/credential.rb +145 -0
- data/lib/omf-sfa/am/default_authorizer.rb +44 -0
- data/lib/omf-sfa/am/privilege_credential.rb +76 -0
- data/lib/omf-sfa/am/signature.rb +37 -0
- data/lib/omf-sfa/am/user_credential.rb +56 -0
- data/lib/omf-sfa/am.rb +7 -0
- data/lib/omf-sfa/model/abstract_prop_description.rb +87 -0
- data/lib/omf-sfa/model/model_class_description.rb +145 -0
- data/lib/omf-sfa/model/model_data_prop_description.rb +28 -0
- data/lib/omf-sfa/model/model_obj_prop_description.rb +49 -0
- data/lib/omf-sfa/model/ontology.rb +169 -0
- data/lib/omf-sfa/resource/README.md +24 -0
- data/lib/omf-sfa/resource/channel.rb +49 -0
- data/lib/omf-sfa/resource/comp_group.rb +41 -0
- data/lib/omf-sfa/resource/component_lease.rb +10 -0
- data/lib/omf-sfa/resource/constants.rb +24 -0
- data/lib/omf-sfa/resource/group_component.rb +35 -0
- data/lib/omf-sfa/resource/group_membership.rb +17 -0
- data/lib/omf-sfa/resource/gurn.rb +187 -0
- data/lib/omf-sfa/resource/interface.rb +78 -0
- data/lib/omf-sfa/resource/ip.rb +48 -0
- data/lib/omf-sfa/resource/link.rb +29 -0
- data/lib/omf-sfa/resource/node.rb +75 -0
- data/lib/omf-sfa/resource/oaccount.rb +94 -0
- data/lib/omf-sfa/resource/ocomponent.rb +134 -0
- data/lib/omf-sfa/resource/ogroup.rb +106 -0
- data/lib/omf-sfa/resource/olease.rb +61 -0
- data/lib/omf-sfa/resource/oproperty.rb +178 -0
- data/lib/omf-sfa/resource/oreference.rb +15 -0
- data/lib/omf-sfa/resource/oresource.rb +491 -0
- data/lib/omf-sfa/resource/project.rb +28 -0
- data/lib/omf-sfa/resource/project_membership.rb +13 -0
- data/lib/omf-sfa/resource/sfa_base.rb +544 -0
- data/lib/omf-sfa/resource/user.rb +25 -0
- data/lib/omf-sfa/resource.rb +20 -0
- data/lib/omf-sfa/util/create_sample_testbed.rb +68 -0
- data/lib/omf-sfa/util/load_from_sfa_xml.rb +65 -0
- data/lib/omf-sfa/version.rb +4 -0
- data/lib/omf_sfa.rb +5 -0
- data/omf_sfa.gemspec +46 -0
- data/owl/README +3 -0
- data/owl/ben-6509.rdf +1377 -0
- data/owl/ben-dell.rdf +586 -0
- data/owl/ben-dtn.rdf +1698 -0
- data/owl/ben.rdf +1335 -0
- data/owl/collections.owl +309 -0
- data/owl/compute.owl +1486 -0
- data/owl/domain.owl +444 -0
- data/owl/dtn.owl +1165 -0
- data/owl/ec2.owl +385 -0
- data/owl/ethernet.owl +466 -0
- data/owl/eucalyptus.owl +431 -0
- data/owl/id-mp-Request1.rdf +247 -0
- data/owl/itu-grid.owl +147 -0
- data/owl/kansei.owl +511 -0
- data/owl/layer.owl +645 -0
- data/owl/location.owl +117 -0
- data/owl/mass.rdf +608 -0
- data/owl/nlr.rdf +901 -0
- data/owl/orca.owl +181 -0
- data/owl/planetlab.owl +124 -0
- data/owl/protogeni.owl +467 -0
- data/owl/request-6509-2.rdf +150 -0
- data/owl/request-6509-3.rdf +158 -0
- data/owl/request-6509.rdf +199 -0
- data/owl/request.owl +222 -0
- data/owl/storage.owl +511 -0
- data/owl/topology.owl +608 -0
- data/schema/rspec-v3/ad-common.xsd +269 -0
- data/schema/rspec-v3/ad-reservation.rnc +12 -0
- data/schema/rspec-v3/ad-reservation.rng +28 -0
- data/schema/rspec-v3/ad-reservation.xsd +13 -0
- data/schema/rspec-v3/ad.rnc +151 -0
- data/schema/rspec-v3/ad.xsd +77 -0
- data/schema/rspec-v3/any-extension-schema.xsd +38 -0
- data/schema/rspec-v3/any-extension.rnc +30 -0
- data/schema/rspec-v3/common.rnc +185 -0
- data/schema/rspec-v3/manifest-common.xsd +244 -0
- data/schema/rspec-v3/manifest-request.xsd +95 -0
- data/schema/rspec-v3/manifest.rnc +62 -0
- data/schema/rspec-v3/manifest.xsd +34 -0
- data/schema/rspec-v3/request-common.xsd +219 -0
- data/schema/rspec-v3/request-reservation.rnc +12 -0
- data/schema/rspec-v3/request-reservation.xsd +13 -0
- data/schema/rspec-v3/request.rnc +118 -0
- data/schema/rspec-v3/request.xsd +94 -0
- data/share/assets/css/default.css +147 -0
- data/share/assets/css/rest_api.css +0 -0
- data/share/assets/network.html +28 -0
- data/share/assets/network.js +82 -0
- data/spec/am/am-rest/common.rb +29 -0
- data/spec/am/am-rest/resource_group_handler_XspecX.rb +97 -0
- data/spec/am/am-rest/resource_handler_spec.rb +204 -0
- data/spec/am/am-rpc/sfa_methods_spec.rb +150 -0
- data/spec/am/am_manager_spec.rb +307 -0
- data/spec/am/am_scheduler_spec.rb +57 -0
- data/spec/am/common.rb +24 -0
- data/spec/resource/common.rb +31 -0
- data/spec/resource/node_spec.rb +171 -0
- data/spec/resource/oaccount_spec.rb +92 -0
- data/spec/resource/ocomponent_spec.rb +225 -0
- data/spec/resource/ogroup_spec.rb +93 -0
- data/spec/resource/oresource_spec.rb +208 -0
- data/spec/resource_and_leases_spec.rb +377 -0
- data/test/OLD_FILES/assertion1.xml +117 -0
- data/test/OLD_FILES/greeter_spec.rb +15 -0
- data/test/OLD_FILES/mongo_test.rb +45 -0
- data/test/OLD_FILES/req-sfa-2.xml +6 -0
- data/test/OLD_FILES/req-sfa-g.xml +8 -0
- data/test/OLD_FILES/req-sfa-g2.xml +10 -0
- data/test/OLD_FILES/req-sfa-g3.xml +14 -0
- data/test/OLD_FILES/req-sfa.xml +6 -0
- data/test/OLD_FILES/req1.xml +22 -0
- data/test/OLD_FILES/req1b.xml +15 -0
- data/test/OLD_FILES/rspec-test.xml +1867 -0
- data/test/OLD_FILES/test.rb +67 -0
- data/test/OLD_FILES/test2.rb +32 -0
- data/test/am/am_manager_rspec_tests.rb +378 -0
- data/test/am/am_manager_tests.rb +518 -0
- data/test/am/am_scheduler_tests.rb +173 -0
- data/test/resource/olease_test.rb +74 -0
- data/test/sfa_requests/request.xml +5 -0
- data/test/sfa_requests/request1.xml +5 -0
- data/test/sfa_requests/request2.xml +5 -0
- data/test/sfa_requests/request3.xml +5 -0
- metadata +601 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<rspec xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" xmlns:client="http://www.protogeni.net/resources/rspec/ext/client/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.geni.net/resources/rspec/3" type="manifest" generated_by="Flack" generated="2013-05-20T01:22:34Z" xsi:schemaLocation="http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/manifest.xsd " expires="2013-05-26T09:11:32Z">
|
|
2
|
+
<node xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="nodeB" component_manager_id="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm" exclusive="false" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+node+pc1" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4538">
|
|
3
|
+
<sliver_type name="emulab-openvz">
|
|
4
|
+
<disk_image name="urn:publicid:IDN+instageni.gpolab.bbn.com+image+emulab-net//GIMIomf"/>
|
|
5
|
+
</sliver_type>
|
|
6
|
+
<services>
|
|
7
|
+
<execute command="sudo sh /local/postboot_script.sh" shell="sh"/>
|
|
8
|
+
<install install_path="/local" url="http://emmy9.casa.umass.edu/InstaGENI_Images/install-script.tar.gz"/>
|
|
9
|
+
<login authentication="ssh-keys" hostname="pc1.instageni.gpolab.bbn.com" port="30779" username="dbhat"/></services>
|
|
10
|
+
<interface client_id="VM:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4545" mac_address="0226ad94606d">
|
|
11
|
+
<ip address="192.168.4.10" netmask="" type="ipv4"/>
|
|
12
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
13
|
+
</interface>
|
|
14
|
+
<interface client_id="VM:if1" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4547" mac_address="02b197e58375">
|
|
15
|
+
<ip address="192.168.1.10" netmask="" type="ipv4"/>
|
|
16
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
17
|
+
</interface>
|
|
18
|
+
<interface client_id="nodeB:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4559" mac_address="020cb099b697">
|
|
19
|
+
<ip address="192.168.2.10" netmask="" type="ipv4"/>
|
|
20
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
21
|
+
</interface>
|
|
22
|
+
<flack:node_info x="327" y="67" unbound="true"/>
|
|
23
|
+
<rs:vnode xmlns:rs="http://www.protogeni.net/resources/rspec/ext/emulab/1" name="pcvm1-3"/><host name="nodeB.dbhatinstageni5.panther.instageni.gpolab.bbn.com"/></node>
|
|
24
|
+
<node xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="nodeA" component_manager_id="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm" exclusive="false" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+node+pc1" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4537">
|
|
25
|
+
<sliver_type name="emulab-openvz">
|
|
26
|
+
<disk_image name="urn:publicid:IDN+instageni.gpolab.bbn.com+image+emulab-net//GIMIomf"/>
|
|
27
|
+
</sliver_type>
|
|
28
|
+
<services>
|
|
29
|
+
<execute command="sudo sh /local/postboot_script.sh" shell="sh"/>
|
|
30
|
+
<install install_path="/local" url="http://emmy9.casa.umass.edu/InstaGENI_Images/install-script.tar.gz"/>
|
|
31
|
+
<login authentication="ssh-keys" hostname="pc1.instageni.gpolab.bbn.com" port="30778" username="dbhat"/></services>
|
|
32
|
+
<interface client_id="VM-0:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4544" mac_address="02245bc31345">
|
|
33
|
+
<ip address="192.168.4.11" netmask="" type="ipv4"/>
|
|
34
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
35
|
+
</interface>
|
|
36
|
+
<interface client_id="VM-0:if1" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4553" mac_address="02b9bd7bb529">
|
|
37
|
+
<ip address="192.168.5.11" netmask="" type="ipv4"/>
|
|
38
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
39
|
+
</interface>
|
|
40
|
+
<flack:node_info x="140" y="164" unbound="true"/>
|
|
41
|
+
<rs:vnode xmlns:rs="http://www.protogeni.net/resources/rspec/ext/emulab/1" name="pcvm1-1"/><host name="nodeA.dbhatinstageni5.panther.instageni.gpolab.bbn.com"/></node>
|
|
42
|
+
<node xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="nodeD" component_manager_id="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm" exclusive="false" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+node+pc1" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4540">
|
|
43
|
+
<sliver_type name="emulab-openvz">
|
|
44
|
+
<disk_image name="urn:publicid:IDN+instageni.gpolab.bbn.com+image+emulab-net//GIMIomf"/>
|
|
45
|
+
</sliver_type>
|
|
46
|
+
<services>
|
|
47
|
+
<execute command="sudo sh /local/postboot_script.sh" shell="sh"/>
|
|
48
|
+
<install install_path="/local" url="http://emmy9.casa.umass.edu/InstaGENI_Images/install-script.tar.gz"/>
|
|
49
|
+
<login authentication="ssh-keys" hostname="pc1.instageni.gpolab.bbn.com" port="30781" username="dbhat"/></services>
|
|
50
|
+
<interface client_id="VM-1:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4548" mac_address="024fd26ba21c">
|
|
51
|
+
<ip address="192.168.1.13" netmask="" type="ipv4"/>
|
|
52
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
53
|
+
</interface>
|
|
54
|
+
<interface client_id="VM-1:if1" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4550" mac_address="0212bfd4b742">
|
|
55
|
+
<ip address="192.168.3.13" netmask="" type="ipv4"/>
|
|
56
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
57
|
+
</interface>
|
|
58
|
+
<flack:node_info x="564" y="168" unbound="true"/>
|
|
59
|
+
<rs:vnode xmlns:rs="http://www.protogeni.net/resources/rspec/ext/emulab/1" name="pcvm1-8"/><host name="nodeD.dbhatinstageni5.panther.instageni.gpolab.bbn.com"/></node>
|
|
60
|
+
<node xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="nodeC" component_manager_id="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm" exclusive="false" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+node+pc1" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4539">
|
|
61
|
+
<sliver_type name="emulab-openvz">
|
|
62
|
+
<disk_image name="urn:publicid:IDN+instageni.gpolab.bbn.com+image+emulab-net//GIMIomf"/>
|
|
63
|
+
</sliver_type>
|
|
64
|
+
<services>
|
|
65
|
+
<execute command="sudo sh /local/postboot_script.sh" shell="sh"/>
|
|
66
|
+
<install install_path="/local" url="http://emmy9.casa.umass.edu/InstaGENI_Images/install-script.tar.gz"/>
|
|
67
|
+
<login authentication="ssh-keys" hostname="pc1.instageni.gpolab.bbn.com" port="30780" username="dbhat"/></services>
|
|
68
|
+
<interface client_id="VM-2:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4551" mac_address="028d9467cc62">
|
|
69
|
+
<ip address="192.168.3.12" netmask="" type="ipv4"/>
|
|
70
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
71
|
+
</interface>
|
|
72
|
+
<interface client_id="VM-2:if1" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4554" mac_address="02e9e343d2be">
|
|
73
|
+
<ip address="192.168.5.12" netmask="" type="ipv4"/>
|
|
74
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
75
|
+
</interface>
|
|
76
|
+
<interface client_id="VM-2:if2" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4556" mac_address="02bc58fc56c1">
|
|
77
|
+
<ip address="192.168.6.12" netmask="" type="ipv4"/>
|
|
78
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
79
|
+
</interface>
|
|
80
|
+
<interface client_id="nodeC:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4560" mac_address="0248d66a8ce1">
|
|
81
|
+
<ip address="192.168.2.12" netmask="" type="ipv4"/>
|
|
82
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
83
|
+
</interface>
|
|
84
|
+
<flack:node_info x="352" y="252" unbound="true"/>
|
|
85
|
+
<rs:vnode xmlns:rs="http://www.protogeni.net/resources/rspec/ext/emulab/1" name="pcvm1-6"/><host name="nodeC.dbhatinstageni5.panther.instageni.gpolab.bbn.com"/></node>
|
|
86
|
+
<node xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="nodeE" component_manager_id="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm" exclusive="false" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+node+pc1" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4541">
|
|
87
|
+
<sliver_type name="emulab-openvz">
|
|
88
|
+
<disk_image name="urn:publicid:IDN+instageni.gpolab.bbn.com+image+emulab-net//GIMIomf"/>
|
|
89
|
+
</sliver_type>
|
|
90
|
+
<services>
|
|
91
|
+
<execute command="sudo sh /local/postboot_script.sh" shell="sh"/>
|
|
92
|
+
<install install_path="/local" url="http://emmy9.casa.umass.edu/InstaGENI_Images/install-script.tar.gz"/>
|
|
93
|
+
<login authentication="ssh-keys" hostname="pc1.instageni.gpolab.bbn.com" port="30782" username="dbhat"/></services>
|
|
94
|
+
<interface client_id="VM-3:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4557" mac_address="027d3d62dc5d">
|
|
95
|
+
<ip address="192.168.6.14" netmask="" type="ipv4"/>
|
|
96
|
+
<flack:interface_info addressBound="true" bound="false"/>
|
|
97
|
+
</interface>
|
|
98
|
+
<flack:node_info x="364" y="389" unbound="true"/>
|
|
99
|
+
<rs:vnode xmlns:rs="http://www.protogeni.net/resources/rspec/ext/emulab/1" name="pcvm1-9"/><host name="nodeE.dbhatinstageni5.panther.instageni.gpolab.bbn.com"/></node>
|
|
100
|
+
<link xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="link0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4543">
|
|
101
|
+
<component_manager name="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm"/>
|
|
102
|
+
<interface_ref client_id="VM-0:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4544"/>
|
|
103
|
+
<interface_ref client_id="VM:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4545"/>
|
|
104
|
+
<property source_id="VM-0:if0" dest_id="VM:if0"/>
|
|
105
|
+
<property source_id="VM:if0" dest_id="VM-0:if0"/>
|
|
106
|
+
<flack:link_info x="-1" y="-1" unboundVlantag="true"/>
|
|
107
|
+
</link>
|
|
108
|
+
<link xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="link1" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4546">
|
|
109
|
+
<component_manager name="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm"/>
|
|
110
|
+
<interface_ref client_id="VM:if1" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4547"/>
|
|
111
|
+
<interface_ref client_id="VM-1:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4548"/>
|
|
112
|
+
<property source_id="VM:if1" dest_id="VM-1:if0"/>
|
|
113
|
+
<property source_id="VM-1:if0" dest_id="VM:if1"/>
|
|
114
|
+
<flack:link_info x="-1" y="-1" unboundVlantag="true"/>
|
|
115
|
+
</link>
|
|
116
|
+
<link xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="link2" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4549">
|
|
117
|
+
<component_manager name="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm"/>
|
|
118
|
+
<interface_ref client_id="VM-1:if1" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4550"/>
|
|
119
|
+
<interface_ref client_id="VM-2:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4551"/>
|
|
120
|
+
<property source_id="VM-1:if1" dest_id="VM-2:if0"/>
|
|
121
|
+
<property source_id="VM-2:if0" dest_id="VM-1:if1"/>
|
|
122
|
+
<flack:link_info x="-1" y="-1" unboundVlantag="true"/>
|
|
123
|
+
</link>
|
|
124
|
+
<link xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="link3" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4552">
|
|
125
|
+
<component_manager name="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm"/>
|
|
126
|
+
<interface_ref client_id="VM-0:if1" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4553"/>
|
|
127
|
+
<interface_ref client_id="VM-2:if1" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4554"/>
|
|
128
|
+
<property source_id="VM-0:if1" dest_id="VM-2:if1"/>
|
|
129
|
+
<property source_id="VM-2:if1" dest_id="VM-0:if1"/>
|
|
130
|
+
<flack:link_info x="-1" y="-1" unboundVlantag="true"/>
|
|
131
|
+
</link>
|
|
132
|
+
<link xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="link4" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4555">
|
|
133
|
+
<component_manager name="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm"/>
|
|
134
|
+
<interface_ref client_id="VM-2:if2" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4556"/>
|
|
135
|
+
<interface_ref client_id="VM-3:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4557"/>
|
|
136
|
+
<property source_id="VM-2:if2" dest_id="VM-3:if0"/>
|
|
137
|
+
<property source_id="VM-3:if0" dest_id="VM-2:if2"/>
|
|
138
|
+
<flack:link_info x="-1" y="-1" unboundVlantag="true"/>
|
|
139
|
+
</link>
|
|
140
|
+
<link xmlns:flack="http://www.protogeni.net/resources/rspec/ext/flack/1" client_id="link5" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4558">
|
|
141
|
+
<component_manager name="urn:publicid:IDN+instageni.gpolab.bbn.com+authority+cm"/>
|
|
142
|
+
<interface_ref client_id="nodeB:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4559"/>
|
|
143
|
+
<interface_ref client_id="nodeC:if0" component_id="urn:publicid:IDN+instageni.gpolab.bbn.com+interface+pc1:lo0" sliver_id="urn:publicid:IDN+instageni.gpolab.bbn.com+sliver+4560"/>
|
|
144
|
+
<property source_id="nodeB:if0" dest_id="nodeC:if0"/>
|
|
145
|
+
<property source_id="nodeC:if0" dest_id="nodeB:if0"/>
|
|
146
|
+
<flack:link_info x="-1" y="-1" unboundVlantag="true"/>
|
|
147
|
+
</link>
|
|
148
|
+
<client:client_info name="Flack" environment="Flash Version: LNX 11,2,202,273, OS: Linux 3.2.0-38-generic-pae, Arch: x86, Screen: 1366x664 @ 72 DPI with touchscreen type none" version="v14.91" url="https://www.emulab.net/protogeni/flack2/flack.swf"/>
|
|
149
|
+
<flack:slice_info view="graph"/>
|
|
150
|
+
</rspec>
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# CSS: /assets/css/default.css
|
|
2
|
+
|
|
3
|
+
Objective
|
|
4
|
+
=========
|
|
5
|
+
|
|
6
|
+
The AM essentially manipulates collections (slivers) of resoruces and their respective properties
|
|
7
|
+
under certain policies.
|
|
8
|
+
|
|
9
|
+
This document proposes a RESTful alternative to the existing XML-RPC based AM API. A short descripton
|
|
10
|
+
of REST can be found on [Wikipedia](http://en.wikipedia.org/wiki/Representational_state_transfer).
|
|
11
|
+
|
|
12
|
+
The current proposal does not yet address access control, but hints on how to achieve that are already present.
|
|
13
|
+
|
|
14
|
+
To get a better understanding of the strength and weaknesses of this API, an experimental implementation has been
|
|
15
|
+
deployed at http://srv.mytestbed.net:4040 and the (rather messy) implementation is available on the
|
|
16
|
+
[OMF Repository](http://omf.mytestbed.net/projects/omf/repository/revisions/sfa/show/omf-sfa/ruby/omf-sfa/am/am-rest).
|
|
17
|
+
|
|
18
|
+
* API
|
|
19
|
+
* Examples
|
|
20
|
+
* Mapping to XML-RPC API
|
|
21
|
+
* Footnotes
|
|
22
|
+
|
|
23
|
+
API
|
|
24
|
+
===
|
|
25
|
+
|
|
26
|
+
* `/resources`
|
|
27
|
+
* GET: List all resources
|
|
28
|
+
* PUT: Not allowed
|
|
29
|
+
* POST: Not allowed
|
|
30
|
+
* DELETE: Not allowed
|
|
31
|
+
|
|
32
|
+
* `/slivers`
|
|
33
|
+
* GET: List all sliver
|
|
34
|
+
* PUT: Not allowed
|
|
35
|
+
* POST: Not allowed
|
|
36
|
+
* DELETE: Not allowed
|
|
37
|
+
|
|
38
|
+
* `/slivers/_sliver_id_`
|
|
39
|
+
* GET: Status of sliver
|
|
40
|
+
* PUT(rspec): Create sliver if not already exist. Apply body to all sub collection
|
|
41
|
+
* POST(rspec): Modify all sub collections according to +rspec+.
|
|
42
|
+
* DELETE: Delete sliver
|
|
43
|
+
|
|
44
|
+
* `/slivers._sliver_id_/resources`
|
|
45
|
+
* GET: Status of all resources in sliver
|
|
46
|
+
* PUT(rspec): Replace all resources in sliver with those described in +rspec+
|
|
47
|
+
* POST(rspec): Modify resources in collection. See (1), (2)
|
|
48
|
+
* DELETE: Remove all resources from sliver
|
|
49
|
+
|
|
50
|
+
* `/slivers/_slice_id_/resources/_resource_id_`
|
|
51
|
+
* GET: Status of resource
|
|
52
|
+
* PUT(rspec): Fully reconfigure resource. Not mentioned properties are set to their default value
|
|
53
|
+
* POST(rspec): Modify names resource properties
|
|
54
|
+
* DELETE: Delete resource (remove from sliver)
|
|
55
|
+
|
|
56
|
+
* `/status` (optional)
|
|
57
|
+
* GET: Status of AM
|
|
58
|
+
|
|
59
|
+
* `/version`
|
|
60
|
+
* GET: Information about capabilites of AM implementation
|
|
61
|
+
|
|
62
|
+
Examples
|
|
63
|
+
========
|
|
64
|
+
|
|
65
|
+
List all resources
|
|
66
|
+
------------------
|
|
67
|
+
|
|
68
|
+
$ curl http://srv.mytestbed.net:4040/resources
|
|
69
|
+
<?xml version="1.0"?>
|
|
70
|
+
<resources_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:14:58+00:00" about="/resources">
|
|
71
|
+
<resources href="/slivers/__DEFAULT__/resources">
|
|
72
|
+
<node id="c-611570898" component_id="urn:publicid:IDN+mytestbed.net+node+r1" component_manager_id="authority+am" component_name="r1" href="/resources/r1">
|
|
73
|
+
<available now="true"/>
|
|
74
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface4"/>
|
|
75
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface6"/>
|
|
76
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface13"/>
|
|
77
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface16"/>
|
|
78
|
+
</node>
|
|
79
|
+
...
|
|
80
|
+
|
|
81
|
+
List status of a single resource
|
|
82
|
+
--------------------------------
|
|
83
|
+
|
|
84
|
+
$ curl http://srv.mytestbed.net:4040/resources/r1<?xml version="1.0"?>
|
|
85
|
+
<resource_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:17:26+00:00" about="/resources/r1">
|
|
86
|
+
<node id="c-610107898" component_id="urn:publicid:IDN+mytestbed.net+node+r1" component_manager_id="authority+am" component_name="r1" href="/resources/r1">
|
|
87
|
+
<available now="true"/>
|
|
88
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface4"/>
|
|
89
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface6"/>
|
|
90
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface13"/>
|
|
91
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface16"/>
|
|
92
|
+
</node>
|
|
93
|
+
</resource_response>
|
|
94
|
+
|
|
95
|
+
List all slivers
|
|
96
|
+
----------------
|
|
97
|
+
|
|
98
|
+
$ curl http://srv.mytestbed.net:4040/slivers
|
|
99
|
+
<?xml version="1.0"?>
|
|
100
|
+
<slivers_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:29:07+00:00" about="/slivers">
|
|
101
|
+
<slivers href="/slivers"/>
|
|
102
|
+
</slivers_response>
|
|
103
|
+
|
|
104
|
+
Create a sliver
|
|
105
|
+
---------------
|
|
106
|
+
|
|
107
|
+
$ curl -X PUT -d @req1.xml http://srv.mytestbed.net:4040/slivers/foo
|
|
108
|
+
<?xml version="1.0"?>
|
|
109
|
+
<sliver_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:30:47+00:00" about="/slivers/foo">
|
|
110
|
+
<sliver href="/foo">
|
|
111
|
+
<resources href="/slivers/foo/resources"/>
|
|
112
|
+
<properties>
|
|
113
|
+
<expires_at>Sun, 27 Nov 2011 23:40:47 +0000</expires_at>
|
|
114
|
+
</properties>
|
|
115
|
+
<assertion/>
|
|
116
|
+
<policies/>
|
|
117
|
+
</sliver>
|
|
118
|
+
</sliver_response>
|
|
119
|
+
|
|
120
|
+
Status of a sliver
|
|
121
|
+
------------------
|
|
122
|
+
|
|
123
|
+
$ curl http://srv.mytestbed.net:4040/slivers/foo
|
|
124
|
+
<?xml version="1.0"?>
|
|
125
|
+
<sliver_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:18:35+00:00" about="/slivers/foo">
|
|
126
|
+
<sliver href="/foo">
|
|
127
|
+
<resources href="/slivers/foo/resources"/>
|
|
128
|
+
<properties>
|
|
129
|
+
<expires_at>Sun, 27 Nov 2011 23:28:35 +0000</expires_at>
|
|
130
|
+
</properties>
|
|
131
|
+
<assertion/>
|
|
132
|
+
<policies/>
|
|
133
|
+
</sliver>
|
|
134
|
+
</sliver_response>
|
|
135
|
+
|
|
136
|
+
List all resources in a sliver
|
|
137
|
+
------------------------------
|
|
138
|
+
|
|
139
|
+
$ curl http://srv.mytestbed.net:4040/slivers/foo/resources
|
|
140
|
+
<?xml version="1.0"?>
|
|
141
|
+
<resources_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:20:04+00:00" about="/slivers/foo/resources">
|
|
142
|
+
<resources href="/slivers/foo/resources">
|
|
143
|
+
<node id="c-610782628" component_id="urn:publicid:IDN+mytestbed.net+node+r0" component_manager_id="authority+am" component_name="r0" href="/slices/foo/resources/r0">
|
|
144
|
+
<available now="true"/>
|
|
145
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface0"/>
|
|
146
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface2"/>
|
|
147
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface12"/>
|
|
148
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface14"/>
|
|
149
|
+
</node>
|
|
150
|
+
<node id="c-610782828" component_id="urn:publicid:IDN+mytestbed.net+node+c0_0" component_manager_id="authority+am" component_name="c0_0" href="/slices/foo/resources/c0_0">
|
|
151
|
+
<available now="true"/>
|
|
152
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface1"/>
|
|
153
|
+
</node>
|
|
154
|
+
<link id="c-610790138" component_id="urn:publicid:IDN+mytestbed.net+link+la0_0" component_manager_id="authority+am" component_name="la0_0" href="/slices/foo/resources/la0_0">
|
|
155
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface0"/>
|
|
156
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface1"/>
|
|
157
|
+
</link>
|
|
158
|
+
</resources>
|
|
159
|
+
</resources_response>
|
|
160
|
+
|
|
161
|
+
Modify resources in sliver
|
|
162
|
+
--------------------------
|
|
163
|
+
|
|
164
|
+
$ cat req1.xml (fetch from http://omf.mytestbed.net/projects/omf/repository/revisions/sfa/entry/omf-sfa/test/req1.xml)
|
|
165
|
+
|
|
166
|
+
<resources xmlns="http://schema.mytestbed.net/am_rest/0.1">
|
|
167
|
+
<node component_id="urn:publicid:IDN+mytestbed.net+node+r0">
|
|
168
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface0"/>
|
|
169
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface2"/>
|
|
170
|
+
</node>
|
|
171
|
+
<node component_id="urn:publicid:IDN+mytestbed.net+node+c0_0">
|
|
172
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface1"/>
|
|
173
|
+
</node>
|
|
174
|
+
...
|
|
175
|
+
|
|
176
|
+
$ curl -X PUT -d @req1.xml http://srv.mytestbed.net:4040/slivers/foo/resources
|
|
177
|
+
<?xml version="1.0"?>
|
|
178
|
+
<resources_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:21:42+00:00" about="/slivers/foo/resources">
|
|
179
|
+
<resources href="/slivers/foo/resources">
|
|
180
|
+
<node id="c-611144758" component_id="urn:publicid:IDN+mytestbed.net+node+r0" component_manager_id="authority+am" component_name="r0" href="/slices/foo/resources/r0">
|
|
181
|
+
<available now="true"/>
|
|
182
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface0"/>
|
|
183
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface2"/>
|
|
184
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface12"/>
|
|
185
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface14"/>
|
|
186
|
+
</node>
|
|
187
|
+
<node id="c-611144958" component_id="urn:publicid:IDN+mytestbed.net+node+c0_0" component_manager_id="authority+am" component_name="c0_0" href="/slices/foo/resources/c0_0">
|
|
188
|
+
<available now="true"/>
|
|
189
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface1"/>
|
|
190
|
+
</node>
|
|
191
|
+
<node id="c-611145158" component_id="urn:publicid:IDN+mytestbed.net+node+c0_1" component_manager_id="authority+am" component_name="c0_1" href="/slices/foo/resources/c0_1">
|
|
192
|
+
<available now="true"/>
|
|
193
|
+
<interface_ref component_id="urn:publicid:IDN+mytestbed.net+interface+interface3"/>
|
|
194
|
+
</node>
|
|
195
|
+
.....
|
|
196
|
+
|
|
197
|
+
Delete individual resources
|
|
198
|
+
---------------------------
|
|
199
|
+
|
|
200
|
+
$ curl -X DELETE http://srv.mytestbed.net:4040/slivers/foo/resources/r0
|
|
201
|
+
<?xml version="1.0"?>
|
|
202
|
+
<resource_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:27:27+00:00" about="/slivers/foo/resources/r0"/>
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
Delete Sliver
|
|
206
|
+
-------------
|
|
207
|
+
|
|
208
|
+
$ curl -X DELETE http://srv.mytestbed.net:4040/slivers/foo
|
|
209
|
+
<?xml version="1.0"?>
|
|
210
|
+
<sliver_response xmlns="http://schema.mytestbed.net/am_rest/0.1" generated="2011-11-27T23:28:10+00:00" about="/slivers/foo"/>
|
|
211
|
+
|
|
212
|
+
Simply cool
|
|
213
|
+
-----------
|
|
214
|
+
|
|
215
|
+
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.6.0s"></script>
|
|
216
|
+
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js"></script>
|
|
217
|
+
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js"></script>
|
|
218
|
+
<script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore.js"></script>
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
<div id="chart"></div>
|
|
222
|
+
<script type="text/javascript" src="assets/network.js"></script>
|
|
223
|
+
|
|
224
|
+
Mapping to XML-RPC API
|
|
225
|
+
======================
|
|
226
|
+
|
|
227
|
+
GetVersion
|
|
228
|
+
----------
|
|
229
|
+
|
|
230
|
+
GET /version
|
|
231
|
+
|
|
232
|
+
ListResources
|
|
233
|
+
-------------
|
|
234
|
+
|
|
235
|
+
GET /resources
|
|
236
|
+
GET /resources?compressed
|
|
237
|
+
GET /resources?available
|
|
238
|
+
|
|
239
|
+
GET /slivers/_sliver_id_/resources
|
|
240
|
+
|
|
241
|
+
CreateSliver
|
|
242
|
+
------------
|
|
243
|
+
|
|
244
|
+
PUT /slivers/_sliver_id_
|
|
245
|
+
|
|
246
|
+
DeleteSliver
|
|
247
|
+
------------
|
|
248
|
+
|
|
249
|
+
DELETE /slivers/_sliver_id_
|
|
250
|
+
|
|
251
|
+
SliverStatus
|
|
252
|
+
------------
|
|
253
|
+
|
|
254
|
+
GET /slivers/_sliver_id_
|
|
255
|
+
GET /slivers/_sliver_id_/resources
|
|
256
|
+
|
|
257
|
+
RenewSliver
|
|
258
|
+
-----------
|
|
259
|
+
|
|
260
|
+
Slivers have options (`/slivers/_sliver_id_/options`) and +expires_at+ maybe one of them which can be
|
|
261
|
+
manipulated through a PUT/POST operation. There is always the option to add a 'pseudo' property which
|
|
262
|
+
achieves the same with a simple call (e.g. `PUT /slivers/_sliver_id_/options/renew`).
|
|
263
|
+
|
|
264
|
+
Shutdown
|
|
265
|
+
--------
|
|
266
|
+
|
|
267
|
+
As this is adestructive command (there is no 'restart') we could simply delete the sliver.
|
|
268
|
+
|
|
269
|
+
DELETE /slivers/_sliver_id_
|
|
270
|
+
|
|
271
|
+
An alternative is to have something like a +running+ option which can be set to false or, like
|
|
272
|
+
'RenewSliver' we could handle this through a 'pseudo' option (e.g. `PUT /slivers/_sliver_id_/options/shutdown`)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
Footnotes:
|
|
276
|
+
==========
|
|
277
|
+
|
|
278
|
+
(1) Managing many resources in a sliver through a single call
|
|
279
|
+
|
|
280
|
+
PUT /slices/_slice_id_
|
|
281
|
+
<resources>
|
|
282
|
+
<resource href="/slices/_slice_id_/resources/_resource_id_" op="_OP_">
|
|
283
|
+
...
|
|
284
|
+
</>
|
|
285
|
+
</>
|
|
286
|
+
|
|
287
|
+
Conceptually every `<resource>` in the list results in 'redirect' to
|
|
288
|
+
|
|
289
|
+
_OP_ /slices/_slice_id_/resources/_resource_id_
|
|
290
|
+
<resource>
|
|
291
|
+
...
|
|
292
|
+
</>
|
|
293
|
+
|
|
294
|
+
(2) Managing access control or policy properties of slivers and resources
|
|
295
|
+
|
|
296
|
+
There are two ways. One is to make it part of the PUT or POST body, the other
|
|
297
|
+
one is using Amazon's S3 example and using sub resources `?acl`, `?policy`.
|
|
298
|
+
The latter would more cleanly map onto `/slivers/_sliver_id_/(acls | policies)`
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
|
|
2
|
+
require 'omf-sfa/am/am-rest/rest_handler'
|
|
3
|
+
require 'omf-sfa/am/am-rest/resource_handler'
|
|
4
|
+
|
|
5
|
+
#require 'omf-sfa/resource/sliver'
|
|
6
|
+
|
|
7
|
+
module OMF::SFA::AM::Rest
|
|
8
|
+
|
|
9
|
+
# Handles the collection of accounts on this AM.
|
|
10
|
+
#
|
|
11
|
+
class AccountHandler < RestHandler
|
|
12
|
+
|
|
13
|
+
def initialize(opts = {})
|
|
14
|
+
super
|
|
15
|
+
@resource_class = OMF::SFA::Resource::OAccount
|
|
16
|
+
opts[:account_handler] = self
|
|
17
|
+
@coll_handlers = {
|
|
18
|
+
active_components: (opts[:resource_handler] || ResourceHandler.new(opts))
|
|
19
|
+
}
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def show_resource_list(opts)
|
|
23
|
+
authenticator = Thread.current["authenticator"]
|
|
24
|
+
prefix = about = opts[:req].path
|
|
25
|
+
resources = OMF::SFA::Resource::OAccount.all()
|
|
26
|
+
show_resources(resources, :resources, opts)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# def find_handler(path, opts)
|
|
30
|
+
# account_id = opts[:resource_uri] = path.shift
|
|
31
|
+
# if account_id
|
|
32
|
+
# account = opts[:account] = find_account(account_id)
|
|
33
|
+
# end
|
|
34
|
+
# return self if path.empty?
|
|
35
|
+
#
|
|
36
|
+
# case comp = path.shift
|
|
37
|
+
# when 'resources'
|
|
38
|
+
# opts[:resource_uri] = path.join('/')
|
|
39
|
+
# #puts "RESOURCE >>> '#{r}'::#{account.inspect}"
|
|
40
|
+
# return @res_handler
|
|
41
|
+
# end
|
|
42
|
+
# raise UnknownResourceException.new "Unknown sub collection '#{comp}' for account '#{account_id}'."
|
|
43
|
+
# end
|
|
44
|
+
#
|
|
45
|
+
# def on_get(account_uri, opts)
|
|
46
|
+
# debug 'get: account_uri: "', account_uri, '"'
|
|
47
|
+
# if account_uri
|
|
48
|
+
# account = opts[:account]
|
|
49
|
+
# show_account_status(account, opts)
|
|
50
|
+
# else
|
|
51
|
+
# show_accounts(opts)
|
|
52
|
+
# end
|
|
53
|
+
# end
|
|
54
|
+
#
|
|
55
|
+
# # def on_put(account_uri, opts)
|
|
56
|
+
# # account = opts[:account] = OMF::SFA::Resource::Sliver.first_or_create(:name => opts[:account_id])
|
|
57
|
+
# # configure_sliver(sliver, opts)
|
|
58
|
+
# # show_sliver_status(sliver, opts)
|
|
59
|
+
# # end
|
|
60
|
+
#
|
|
61
|
+
# def on_delete(account_uri, opts)
|
|
62
|
+
# account = opts[:account]
|
|
63
|
+
# @am_manager.delete_account(account)
|
|
64
|
+
#
|
|
65
|
+
# show_account_status(nil, opts)
|
|
66
|
+
# end
|
|
67
|
+
#
|
|
68
|
+
# # SUPPORTING FUNCTIONS
|
|
69
|
+
#
|
|
70
|
+
# def show_account_status(account, opts)
|
|
71
|
+
# if account
|
|
72
|
+
# p = opts[:req].path.split('/')[0 .. -2]
|
|
73
|
+
# p << account.uuid.to_s
|
|
74
|
+
# prefix = about = p.join('/')
|
|
75
|
+
# res = {
|
|
76
|
+
# :about => about,
|
|
77
|
+
# :type => 'account',
|
|
78
|
+
# :properties => {
|
|
79
|
+
# #:href => prefix + '/properties',
|
|
80
|
+
# :expires_at => (Time.now + 600).rfc2822
|
|
81
|
+
# },
|
|
82
|
+
# :resources => {:href => prefix + '/resources'},
|
|
83
|
+
# :policies => {:href => prefix + '/policies'},
|
|
84
|
+
# :assertion => {:href => prefix + '/assertion'}
|
|
85
|
+
# }
|
|
86
|
+
# else
|
|
87
|
+
# res = {:error => 'Unknown account'}
|
|
88
|
+
# end
|
|
89
|
+
#
|
|
90
|
+
# ['application/json', JSON.pretty_generate({:account_response => res})]
|
|
91
|
+
# end
|
|
92
|
+
#
|
|
93
|
+
# def show_accounts(opts)
|
|
94
|
+
# authenticator = Thread.current["authenticator"]
|
|
95
|
+
# prefix = about = opts[:req].path
|
|
96
|
+
# accounts = @am_manager.find_all_accounts(authenticator).collect do |a|
|
|
97
|
+
# {
|
|
98
|
+
# :name => a.name,
|
|
99
|
+
# :urn => a.urn,
|
|
100
|
+
# :uuid => uuid = a.uuid.to_s,
|
|
101
|
+
# :href => prefix + '/' + uuid
|
|
102
|
+
# }
|
|
103
|
+
# end
|
|
104
|
+
# res = {
|
|
105
|
+
# :about => opts[:req].path,
|
|
106
|
+
# :accounts => accounts
|
|
107
|
+
# }
|
|
108
|
+
#
|
|
109
|
+
# ['application/json', JSON.pretty_generate({:accounts_response => res})]
|
|
110
|
+
# end
|
|
111
|
+
#
|
|
112
|
+
# # Configure the state of +account+ according to information
|
|
113
|
+
# # in the http +req+.
|
|
114
|
+
# #
|
|
115
|
+
# # Note: It doesn't actually modify the account directly, but parses the
|
|
116
|
+
# # the body and delegates the individual entries to the relevant
|
|
117
|
+
# # sub collections, like 'resources', 'policies', ...
|
|
118
|
+
# #
|
|
119
|
+
# def configure_account(account, opts)
|
|
120
|
+
# doc, format = parse_body(opts)
|
|
121
|
+
# case format
|
|
122
|
+
# when :xml
|
|
123
|
+
# doc.xpath("//r:resources", 'r' => 'http://schema.mytestbed.net/am_rest/0.1').each do |rel|
|
|
124
|
+
# @res_handler.put_components_xml(rel, opts)
|
|
125
|
+
# end
|
|
126
|
+
# else
|
|
127
|
+
# raise BadRequestException.new "Unsupported message format '#{format}'"
|
|
128
|
+
# end
|
|
129
|
+
# end
|
|
130
|
+
#
|
|
131
|
+
# def find_account(account_id)
|
|
132
|
+
# if account_id.start_with?('urn')
|
|
133
|
+
# fopts = {:urn => account_id}
|
|
134
|
+
# else
|
|
135
|
+
# begin
|
|
136
|
+
# fopts = {:uuid => UUIDTools::UUID.parse(account_id)}
|
|
137
|
+
# rescue ArgumentError
|
|
138
|
+
# fopts = {:name => account_id}
|
|
139
|
+
# end
|
|
140
|
+
# end
|
|
141
|
+
# authenticator = Thread.current["authenticator"]
|
|
142
|
+
# account = @am_manager.find_account(fopts, authenticator)
|
|
143
|
+
# end
|
|
144
|
+
end
|
|
145
|
+
end
|