source: trunk/packages/xen-3.1/xen-3.1/tools/xm-test/tests/security-acm/03_security-acm_dom_conflict.py @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

  • Property svn:mime-type set to text/script
File size: 1.7 KB
Line 
1#!/usr/bin/python
2
3# Copyright (C) International Business Machines Corp., 2006
4# Author: Stefan Berger <stefanb@us.ibm.com>
5#
6# A test that exercises the conflict set of the chinese wall policy.
7# Start a first domain and then a second one. The second one is
8# expected NOT to be starteable.
9
10from XmTestLib import *
11from acm_utils import *
12import commands
13import os
14
15testlabel1 = "blue"
16testlabel2 = "red"
17
18config = {"access_control":"policy=%s,label=%s" % (testpolicy,testlabel1)}
19
20domain1 = XmTestDomain(name="domain-%s" % testlabel1,
21                       extraConfig=config)
22
23try:
24    domain1.start(noConsole=True)
25except DomainError, e:
26    if verbose:
27        print e.extra
28    FAIL("Unable to start 1st labeled test domain")
29
30# Verify with xm dry-run
31status, output = traceCommand("xm dry-run /tmp/xm-test.conf | "
32                              "grep -v \"Dry Run\"")
33if status != 0:
34    FAIL("'xm dry-run' failed")
35if not re.search("PERMITTED", output):
36    FAIL("'xm dry-run' did not succeed.")
37
38config = {"access_control":"policy=%s,label=%s" % (testpolicy,testlabel2)}
39
40domain2 = XmTestDomain(name="domain-%s" % testlabel2,
41                       extraConfig=config)
42
43try:
44    domain2.start(noConsole=True)
45    # Should never get here!
46    FAIL("Could start a domain in a conflict set - "
47         "this should not be possible")
48except DomainError, e:
49    #This is exactly what we want in this case
50    status = 0
51
52# Verify with xm dry-run
53status, output = traceCommand("xm dry-run /tmp/xm-test.conf | "
54                              "grep -v \"Dry Run\"")
55if status != 0:
56    FAIL("'xm dry-run' failed.")
57if not re.search("PERMITTED", output):
58    FAIL("'xm dry-run' did not show that operation was permitted.")
59
60domain1.destroy()
Note: See TracBrowser for help on using the repository browser.