Ask Your Question
2

How can I implement Reactive and Proactive action policy rules through CLI command in congress?

asked 2015-08-31 01:37:22 -0500

himanshu05 gravatar image

I am new to Congress as a user and is in a process of learning its utilities. I want to know how I can create reactive and proactive policy rules in congress. I searched many links but didn't find any output. I am badly stuck in the same. Kindly ( all ) help me out by providing examples of CLI command with their output and help me understanding how the rule is actually working.

Waiting for the reply. Thanks in Advance.

edit retag flag offensive close merge delete

Comments

Hi Jayaprakash, Thanks for the reply. Can you please provide me some working example for the Proactive policy also. If possible can you also provide me the list of CLI commands for the congress policy , rule creation and deletion .

himanshu05 gravatar imagehimanshu05 ( 2015-09-20 02:46:33 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-09-15 02:03:12 -0500

updated 2015-09-15 02:12:48 -0500

Hi,

I was also stuck with the same problem on how to create a Congress Reactive policy and finally found that.

Please refer the below steps by which i tested it

  • Create Policy "inst_delete"
  • Create Policy Rule to identify a instance with the name "congress_test"
  • Verify the extracted output table based on the defined policy rule
  • Create Reactive execution policy and link it to policy rule
  • Recheck the policy rule row list and ensure the instance (congress_test) is deleted

Refer the below cli commands

(openstack) congress policy create inst_delete
+--------------+--------------------------------------+
| Field        | Value                                |
+--------------+--------------------------------------+
| abbreviation | inst_                                |
| description  |                                      |
| id           | c9713311-fe4b-479f-bf47-cea10326aa02 |
| kind         | nonrecursive                         |
| name         | inst_delete                          |
| owner_id     | user                                 |
+--------------+--------------------------------------+
(openstack) congress policy rule create inst_delete "rule1(i, x) :- nova:servers(id=i, name=x), equal(x, 'congress_test')"
+---------+-------------------------------------------------------------------------+
| Field   | Value                                                                   |
+---------+-------------------------------------------------------------------------+
| comment | None                                                                    |
| id      | 42bb940a-f378-4a60-9423-ef641aac0f16                                    |
| name    | None                                                                    |
| rule    | rule1(i, x) :-                                                          |
|         |     nova:servers(i, x, _x_0_2, _x_0_3, _x_0_4, _x_0_5, _x_0_6, _x_0_7), |
|         |     equal(x, "congress_test")                                           |
+---------+-------------------------------------------------------------------------+
(openstack) congress policy row list inst_delete rule1
+--------------------------------------+---------------+
| Col0                                 | Col1          |
+--------------------------------------+---------------+
| 557c634a-d28f-4eaa-8f12-33a6cb37e11a | congress_test |
+--------------------------------------+---------------+
(openstack) congress policy rule create inst_delete "execute[nova:servers.delete(i)] :- rule1(i, x)"
+---------+--------------------------------------+
| Field   | Value                                |
+---------+--------------------------------------+
| comment | None                                 |
| id      | 5280d927-b395-4d57-a2dd-890dddc9bfa3 |
| name    | None                                 |
| rule    | execute[nova:servers.delete(i)] :-   |
|         |     rule1(i, x)                      |
+---------+--------------------------------------+
(openstack) congress policy row list inst_delete rule1

(openstack)

Congress Server Log:

015-09-15 06:36:29.918 2603 INFO PolicyEngine [-] registered trigger: Trigger on table=nova:servers.delete; policy=inst_delete; modal=execute with callback <function <lambda> at 0x7ff91d8ecd70>.
2015-09-15 06:36:29.919 2603 INFO PolicyEngine [-] relevant triggers (update): Trigger on table=nova:servers.delete; policy=inst_delete; modal=execute with callback <function <lambda> at 0x7ff91d8ecd70>.
2015-09-15 06:36:29.922 2603 INFO PolicyEngine [-] engine:: on service nova executing servers.delete on ['557c634a-d28f-4eaa-8f12-33a6cb37e11a']
2015-09-15 06:36:29.922 2603 INFO PolicyEngine [-] engine:: executing: nova:servers.delete on {'positional': ['557c634a-d28f-4eaa-8f12-33a6cb37e11a']}
2015-09-15 06:36:29.922 2603 INFO PolicyEngine [-] Sending request(nova:servers.delete), args = {'positional': ['557c634a-d28f-4eaa-8f12-33a6cb37e11a']}
2015-09-15 06:36:29.980 2603 INFO congress.datasources.datasource_driver [-] nova:: reqhandler: <to:nova, from:engine, corrId:66c523ee-1dc5-450d-a6ed-33c67953faf3, type:req, dataindex:servers.delete, body:{'positional': ['557c634a-d28f-4eaa-8f12-33a6cb37e11a']}>
edit flag offensive delete link more

Comments

Hi Jayaprakash, Thanks for the reply. Can you please provide me some working example for the Proactive policy also. If possible can you also provide me the list of CLI commands for the congress policy , rule creation and deletion .

himanshu05 gravatar imagehimanshu05 ( 2015-09-20 02:47:03 -0500 )edit
jayaprakash gravatar imagejayaprakash ( 2015-09-21 06:44:09 -0500 )edit

Hi Jayaprakash. Thanks for the reply. If possible can you please provide some more example in reactive policy as the one provided earlier. Can you please help me out in this.

himanshu05 gravatar imagehimanshu05 ( 2015-09-24 03:19:57 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

Stats

Asked: 2015-08-31 01:37:22 -0500

Seen: 158 times

Last updated: Sep 15 '15