RSpec extension help

0 views
Skip to first unread message

Tom Mitchell

unread,
Mar 2, 2012, 9:59:02 AM3/2/12
to protog...@googlegroups.com, Tom Mitchell
Hi,

I'm trying to write an RSpec extension and I need a little help. I'd like to add a new tag within the services tag of a node in the GENI v3 request RSpec. I intend for it to work like this:

<?xml version="1.0" encoding="UTF-8"?>
       xsi:schemaLocation="http://www.geni.net/resources/rspec/3
                           http://www.geni.net/resources/rspec/3/request.xsd
                           http://example.com/rspec/extension/
                           http://example.com/rspec/extension/foo.xsd"
       type="request" >
  <node client_id="node">
    <services>
      <example:velocity_script>
#!/bin/sh
  wget http://www.geni.net/myconf.xml &gt; /tmp/wget.log
#
  wget http://www.geni.net/mysetup.sh &gt; /tmp/setup.log
      </example:velocity_script>
    </services>
  </node>
</rspec>


I followed along with http://www.protogeni.net/trac/protogeni/wiki/RSpecCreatingExtension and generated a RelaxNG Compact file for the tag:

Services = element velocity_script { text }
start = Services


This works fine, except it doesn't require the tag to be a child of the services tag. That's where I've hit a wall. Here's my attempt, which doesn't seem to be doing what I want:


RSpec = 
element geni:rspec {
 element geni:node { Node }*
}
Node = element geni:services { Services }
Services = element orca:velocity_script { text }
start = RSpec


Am I on the right track? Do you have suggestions or recommendations? Are there good (and short) examples I could look at?

My read of the ptop_extension and top_extension is that at least some of the tags, like "node_type" could get put anywhere. I haven't tested that theory, so it might be off base. Do you know?

Thanks a lot,
Tom



Jonathon Duerig

unread,
Mar 2, 2012, 11:03:36 AM3/2/12
to protog...@googlegroups.com, Tom Mitchell
This is a limitation of the verification technology. There is no way in a
schema to put the 'context' where the outermost tag should go. See the
fourth paragraph on this page:

http://www.protogeni.net/trac/protogeni/wiki/RSpecExtensions2

This is not ideal, but as far as I know, there is no way to work around it
with standard tools

---
Broad audience or deep message: Pick one.


On Fri, 2 Mar 2012, Tom Mitchell wrote:

> Hi,
> I'm trying to write an RSpec extension and I need a little help. I'd like to
> add a new tag within the services tag of a node in the GENI v3 request
> RSpec. I intend for it to work like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <rspec xmlns="http://www.geni.net/resources/rspec/3"

> ᅵ ᅵ ᅵ ᅵxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> ᅵ ᅵ ᅵ ᅵxmlns:orca="http://www.gpolab.bbn.com/internal/userdir/tmitchel"
> ᅵ ᅵ ᅵ ᅵxsi:schemaLocation="http://www.geni.net/resources/rspec/3
> ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵhttp://www.geni.net/resources/rspec/3/request.xsd
> ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵhttp://example.com/rspec/extension/
> ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵ ᅵhttp://example.com/rspec/extension/foo.xsd"
> ᅵ ᅵ ᅵ ᅵtype="request" >
> ᅵ <node client_id="node">
> ᅵ ᅵ <services>
> ᅵ ᅵ ᅵ <example:velocity_script>
> #!/bin/sh
> ᅵ wget http://www.geni.net/myconf.xml &gt; /tmp/wget.log
> #
> ᅵ wget http://www.geni.net/mysetup.sh &gt; /tmp/setup.log
> ᅵ ᅵ ᅵ </example:velocity_script>
> ᅵ ᅵ </services>
> ᅵ </node>
> </rspec>
>
>
> I followed alongwithᅵhttp://www.protogeni.net/trac/protogeni/wiki/RSpecCreatingExtensionᅵan


> d generated a RelaxNG Compact file for the tag:
>
> default namespace = "http://example.com/rspec/extension/"
> Services = element velocity_script { text }
> start = Services
>
>
> This works fine, except it doesn't require the tag to be a child of the
> services tag. That's where I've hit a wall. Here's my attempt, which doesn't
> seem to be doing what I want:
>
> namespace geni = "http://www.geni.net/resources/rspec/3"
> default namespace = "http://example.com/rspec/extension/"
>

> RSpec =ᅵ
> element geni:rspec {
> ᅵelement geni:node { Node }*

Reply all
Reply to author
Forward
0 new messages