3 from sfa.rspecs.pg_rspec_converter import PGRSpecConverter
4 from sfa.rspecs.sfa_rspec_converter import SfaRSpecConverter
5 from sfa.rspecs.sfa_rspec import sfa_rspec_version
6 from sfa.rspecs.pg_rspec import pg_rspec_ad_version, pg_rspec_request_version
7 from sfa.rspecs.rspec_parser import parse_rspec
13 def to_sfa_rspec(in_rspec):
14 rspec = parse_rspec(in_rspec)
15 if rspec.version['type'] == sfa_rspec_version['type']:
17 elif rspec.version['type'] == pg_rspec_ad_version['type']:
18 return PGRSpecConverter.to_sfa_rspec(in_rspec)
23 def to_pg_rspec(in_rspec):
24 rspec = parse_rspec(in_rspec)
25 if rspec.version['type'] == pg_rspec_ad_version['type']:
27 elif rspec.version['type'] == sfa_rspec_version['type']:
28 return SfaRSpecConverter.to_pg_rspec(in_rspec)
33 if __name__ == '__main__':
34 pg_rspec = 'test/protogeni.rspec'
35 sfa_rspec = 'test/nodes.rspec'
37 print "converting pg rspec to sfa rspec"
38 print RSpecConverter.to_sfa_rspec(pg_rspec)
40 print "converting sfa rspec to pg rspec"
41 print RSpecConverter.to_pg_rspec(sfa_rspec)