INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (78,'dateTime-add-dayTimeDuration','urn:oasis:names:tc:xacml:3.0:function:dateTime-add-dayTimeDuration',19,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (79,'dateTime-add-yearMonthDuration','urn:oasis:names:tc:xacml:3.0:function:dateTime-add-yearMonthDuration',19,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (80,'dateTime-subtract-dayTimeDuration','urn:oasis:names:tc:xacml:3.0:function:dateTime-subtract-dayTimeDuration',19,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (81,'dateTime-subtract-yearMonthDuration','urn:oasis:names:tc:xacml:3.0:function:dateTime-subtract-yearMonthDuration',19,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (82,'date-add-yearMonthDuration','urn:oasis:names:tc:xacml:3.0:function:date-add-yearMonthDuration',21,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (83,'date-subtract-yearMonthDuration','urn:oasis:names:tc:xacml:3.0:function:date-subtract-yearMonthDuration',21,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (84,'string-greater-than','urn:oasis:names:tc:xacml:1.0:function:string-greater-than',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (85,'string-greater-than-or-equal','urn:oasis:names:tc:xacml:1.0:function:string-greater-than-or-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (86,'string-less-than','urn:oasis:names:tc:xacml:1.0:function:string-less-than',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (87,'string-less-than-or-equal','urn:oasis:names:tc:xacml:1.0:function:string-less-than-or-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (88,'time-greater-than','urn:oasis:names:tc:xacml:1.0:function:time-greater-than',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (89,'time-greater-than-or-equal','urn:oasis:names:tc:xacml:1.0:function:time-greater-than-or-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (90,'time-less-than','urn:oasis:names:tc:xacml:1.0:function:time-less-than',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (91,'time-less-than-or-equal','urn:oasis:names:tc:xacml:1.0:function:time-less-than-or-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (92,'time-in-range','urn:oasis:names:tc:xacml:2.0:function:time-in-range',18,0,0,3,3,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (93,'dateTime-greater-than','urn:oasis:names:tc:xacml:1.0:function:dateTime-greater-than',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (94,'dateTime-greater-than-or-equal','urn:oasis:names:tc:xacml:1.0:function:dateTime-greater-than-or-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (95,'dateTime-less-than','urn:oasis:names:tc:xacml:1.0:function:dateTime-less-than',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (96,'dateTime-less-than-or-equal','urn:oasis:names:tc:xacml:1.0:function:dateTime-less-than-or-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (97,'date-greater-than','urn:oasis:names:tc:xacml:1.0:function:date-greater-than',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (98,'date-greater-than-or-equal','urn:oasis:names:tc:xacml:1.0:function:date-greater-than-or-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (99,'date-less-than','urn:oasis:names:tc:xacml:1.0:function:date-less-than',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (100,'date-less-than-or-equal','urn:oasis:names:tc:xacml:1.0:function:date-less-than-or-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (101,'string-one-and-only','urn:oasis:names:tc:xacml:1.0:function:string-one-and-only',26,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (102,'string-bag-size','urn:oasis:names:tc:xacml:1.0:function:string-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (103,'string-is-in','urn:oasis:names:tc:xacml:1.0:function:string-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (104,'string-bag','urn:oasis:names:tc:xacml:1.0:function:string-bag',26,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (105,'integer-bag-size','urn:oasis:names:tc:xacml:1.0:function:integer-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (106,'integer-is-in','urn:oasis:names:tc:xacml:1.0:function:integer-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (107,'integer-bag','urn:oasis:names:tc:xacml:1.0:function:integer-bag',12,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (108,'double-bag-size','urn:oasis:names:tc:xacml:1.0:function:double-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (109,'double-is-in','urn:oasis:names:tc:xacml:1.0:function:double-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (110,'double-bag','urn:oasis:names:tc:xacml:1.0:function:double-bag',25,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (111,'boolean-one-and-only','urn:oasis:names:tc:xacml:1.0:function:boolean-one-and-only',18,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (112,'boolean-bag-size','urn:oasis:names:tc:xacml:1.0:function:boolean-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (113,'boolean-is-in','urn:oasis:names:tc:xacml:1.0:function:boolean-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (114,'boolean-bag','urn:oasis:names:tc:xacml:1.0:function:boolean-bag',18,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (115,'time-one-and-only','urn:oasis:names:tc:xacml:1.0:function:time-one-and-only',16,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (116,'time-bag-size','urn:oasis:names:tc:xacml:1.0:function:time-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (117,'time-is-in','urn:oasis:names:tc:xacml:1.0:function:time-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (118,'time-bag','urn:oasis:names:tc:xacml:1.0:function:time-bag',16,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (119,'date-one-and-only','urn:oasis:names:tc:xacml:1.0:function:date-one-and-only',21,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (120,'date-bag-size','urn:oasis:names:tc:xacml:1.0:function:date-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (121,'date-is-in','urn:oasis:names:tc:xacml:1.0:function:date-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (122,'date-bag','urn:oasis:names:tc:xacml:1.0:function:date-bag',21,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (123,'dateTime-one-and-only','urn:oasis:names:tc:xacml:1.0:function:dateTime-one-and-only',19,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (124,'dateTime-bag-size','urn:oasis:names:tc:xacml:1.0:function:dateTime-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (125,'dateTime-is-in','urn:oasis:names:tc:xacml:1.0:function:dateTime-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (126,'dateTime-bag','urn:oasis:names:tc:xacml:1.0:function:dateTime-bag',19,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (127,'anyURI-one-and-only','urn:oasis:names:tc:xacml:1.0:function:anyURI-one-and-only',27,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (128,'anyURI-bag-size','urn:oasis:names:tc:xacml:1.0:function:anyURI-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (129,'anyURI-is-in','urn:oasis:names:tc:xacml:1.0:function:anyURI-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (130,'anyURI-bag','urn:oasis:names:tc:xacml:1.0:function:anyURI-bag',27,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (131,'hexBinary-one-and-only','urn:oasis:names:tc:xacml:1.0:function:hexBinary-one-and-only',24,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (132,'hexBinary-bag-size','urn:oasis:names:tc:xacml:1.0:function:hexBinary-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (133,'hexBinary-is-in','urn:oasis:names:tc:xacml:1.0:function:hexBinary-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (134,'hexBinary-bag','urn:oasis:names:tc:xacml:1.0:function:hexBinary-bag',24,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (135,'base64Binary-one-and-only','urn:oasis:names:tc:xacml:1.0:function:base64Binary-one-and-only',13,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (136,'base64Binary-bag-size','urn:oasis:names:tc:xacml:1.0:function:base64Binary-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (137,'base64Binary-is-in','urn:oasis:names:tc:xacml:1.0:function:base64Binary-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (138,'base64Binary-bag','urn:oasis:names:tc:xacml:1.0:function:base64Binary-bag',13,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (139,'dayTimeDuration-one-and-only','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-one-and-only',15,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (140,'dayTimeDuration-bag-size','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (141,'dayTimeDuration-is-in','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (142,'dayTimeDuration-bag','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-bag',15,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (143,'yearMonthDuration-one-and-only','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-one-and-only',23,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (144,'yearMonthDuration-bag-size','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (145,'yearMonthDuration-is-in','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (146,'yearMonthDuration-bag','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-bag',23,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (147,'x500Name-one-and-only','urn:oasis:names:tc:xacml:1.0:function:x500Name-one-and-only',14,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (148,'x500Name-bag-size','urn:oasis:names:tc:xacml:1.0:function:x500Name-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (149,'x500Name-is-in','urn:oasis:names:tc:xacml:1.0:function:x500Name-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (150,'x500Name-bag','urn:oasis:names:tc:xacml:1.0:function:x500Name-bag',14,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (151,'rfc822Name-one-and-only','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-one-and-only',20,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (152,'rfc822Name-bag-size','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (153,'rfc822Name-is-in','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (154,'rfc822Name-bag','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-bag',20,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (155,'ipAddress-one-and-only','urn:oasis:names:tc:xacml:2.0:function:ipAddress-one-and-only',22,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (156,'ipAddress-bag-size','urn:oasis:names:tc:xacml:2.0:function:ipAddress-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (157,'ipAddress-is-in','urn:oasis:names:tc:xacml:2.0:function:ipAddress-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (158,'ipAddress-bag','urn:oasis:names:tc:xacml:2.0:function:ipAddress-bag',22,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (159,'dnsName-one-and-only','urn:oasis:names:tc:xacml:2.0:function:dnsName-one-and-only',17,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (160,'dnsName-bag-size','urn:oasis:names:tc:xacml:2.0:function:dnsName-bag-size',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (161,'dnsName-is-in','urn:oasis:names:tc:xacml:2.0:function:dnsName-is-in',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (162,'dnsName-bag','urn:oasis:names:tc:xacml:2.0:function:dnsName-bag',17,1,0,1,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (163,'string-regexp-match','urn:oasis:names:tc:xacml:1.0:function:string-regexp-match',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (164,'anyURI-regexp-match','urn:oasis:names:tc:xacml:2.0:function:anyURI-regexp-match',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (165,'ipAddress-regexp-match','urn:oasis:names:tc:xacml:2.0:function:ipAddress-regexp-match',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (166,'dnsName-regexp-match','urn:oasis:names:tc:xacml:2.0:function:dnsName-regexp-match',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (167,'rfc822Name-regexp-match','urn:oasis:names:tc:xacml:2.0:function:rfc822Name-regexp-match',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (168,'x500Name-regexp-match','urn:oasis:names:tc:xacml:2.0:function:x500Name-regexp-match',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (169,'string-intersection','urn:oasis:names:tc:xacml:1.0:function:string-intersection',26,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (170,'string-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (171,'string-union','urn:oasis:names:tc:xacml:1.0:function:string-union',26,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (172,'string-subset','urn:oasis:names:tc:xacml:1.0:function:string-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (173,'string-set-equals','urn:oasis:names:tc:xacml:1.0:function:string-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (174,'integer-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:integer-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (175,'integer-union','urn:oasis:names:tc:xacml:1.0:function:integer-union',12,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (176,'integer-subset','urn:oasis:names:tc:xacml:1.0:function:integer-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (177,'integer-set-equals','urn:oasis:names:tc:xacml:1.0:function:integer-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (178,'double-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:double-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (179,'double-union','urn:oasis:names:tc:xacml:1.0:function:double-union',25,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (180,'double-subset','urn:oasis:names:tc:xacml:1.0:function:double-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (181,'double-set-equals','urn:oasis:names:tc:xacml:1.0:function:double-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (182,'boolean-intersection','urn:oasis:names:tc:xacml:1.0:function:boolean-intersection',18,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (183,'boolean-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:boolean-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (184,'boolean-union','urn:oasis:names:tc:xacml:1.0:function:boolean-union',18,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (185,'boolean-subset','urn:oasis:names:tc:xacml:1.0:function:boolean-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (186,'boolean-set-equals','urn:oasis:names:tc:xacml:1.0:function:boolean-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (187,'time-intersection','urn:oasis:names:tc:xacml:1.0:function:time-intersection',16,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (188,'time-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:time-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (189,'time-union','urn:oasis:names:tc:xacml:1.0:function:time-union',16,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (190,'time-subset','urn:oasis:names:tc:xacml:1.0:function:time-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (191,'time-set-equals','urn:oasis:names:tc:xacml:1.0:function:time-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (192,'date-intersection','urn:oasis:names:tc:xacml:1.0:function:date-intersection',21,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (193,'date-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:date-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (194,'date-union','urn:oasis:names:tc:xacml:1.0:function:date-union',21,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (195,'date-subset','urn:oasis:names:tc:xacml:1.0:function:date-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (196,'date-set-equals','urn:oasis:names:tc:xacml:1.0:function:date-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (197,'dateTime-intersection','urn:oasis:names:tc:xacml:1.0:function:dateTime-intersection',19,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (198,'dateTime-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:dateTime-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (199,'dateTime-union','urn:oasis:names:tc:xacml:1.0:function:dateTime-union',19,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (200,'dateTime-subset','urn:oasis:names:tc:xacml:1.0:function:dateTime-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (201,'dateTime-set-equals','urn:oasis:names:tc:xacml:1.0:function:dateTime-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (202,'anyURI-intersection','urn:oasis:names:tc:xacml:1.0:function:anyURI-intersection',27,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (203,'anyURI-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:anyURI-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (204,'anyURI-union','urn:oasis:names:tc:xacml:1.0:function:anyURI-union',27,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (205,'anyURI-subset','urn:oasis:names:tc:xacml:1.0:function:anyURI-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (206,'anyURI-set-equals','urn:oasis:names:tc:xacml:1.0:function:anyURI-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (207,'hexBinary-intersection','urn:oasis:names:tc:xacml:1.0:function:hexBinary-intersection',24,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (208,'hexBinary-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:hexBinary-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (209,'hexBinary-union','urn:oasis:names:tc:xacml:1.0:function:hexBinary-union',24,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (210,'hexBinary-subset','urn:oasis:names:tc:xacml:1.0:function:hexBinary-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (211,'hexBinary-set-equals','urn:oasis:names:tc:xacml:1.0:function:hexBinary-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (212,'base64Binary-intersection','urn:oasis:names:tc:xacml:1.0:function:base64Binary-intersection',13,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (213,'base64Binary-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:base64Binary-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (214,'base64Binary-union','urn:oasis:names:tc:xacml:1.0:function:base64Binary-union',13,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (215,'base64Binary-subset','urn:oasis:names:tc:xacml:1.0:function:base64Binary-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (216,'base64Binary-set-equals','urn:oasis:names:tc:xacml:1.0:function:base64Binary-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (217,'dayTimeDuration-intersection','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-intersection',15,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (218,'dayTimeDuration-at-least-one-member-of','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (219,'dayTimeDuration-union','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-union',15,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (220,'dayTimeDuration-subset','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (221,'dayTimeDuration-set-equals','urn:oasis:names:tc:xacml:3.0:function:dayTimeDuration-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (222,'yearMonthDuration-intersection','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-intersection',23,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (223,'yearMonthDuration-at-least-one-member-of','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (224,'yearMonthDuration-union','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-union',23,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (225,'yearMonthDuration-subset','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (226,'yearMonthDuration-set-equals','urn:oasis:names:tc:xacml:3.0:function:yearMonthDuration-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (227,'x500Name-intersection','urn:oasis:names:tc:xacml:1.0:function:x500Name-intersection',14,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (228,'x500Name-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:x500Name-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (229,'x500Name-union','urn:oasis:names:tc:xacml:1.0:function:x500Name-union',14,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (230,'x500Name-subset','urn:oasis:names:tc:xacml:1.0:function:x500Name-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (231,'x500Name-set-equals','urn:oasis:names:tc:xacml:1.0:function:x500Name-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (232,'rfc822Name-intersection','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-intersection',20,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (233,'rfc822Name-at-least-one-member-of','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-at-least-one-member-of',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (234,'rfc822Name-union','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-union',20,1,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (235,'rfc822Name-subset','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-subset',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (236,'rfc822Name-set-equals','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-set-equals',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (237,'x500Name-match','urn:oasis:names:tc:xacml:1.0:function:x500Name-match',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (238,'rfc822Name-match','urn:oasis:names:tc:xacml:1.0:function:rfc822Name-match',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (239,'integer-intersection','urn:oasis:names:tc:xacml:1.0:function:integer-intersection',12,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (240,'double-intersection','urn:oasis:names:tc:xacml:1.0:function:double-intersection',25,1,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (241,'or','urn:oasis:names:tc:xacml:1.0:function:or',18,0,0,0,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (242,'and','urn:oasis:names:tc:xacml:1.0:function:and',18,0,0,0,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (243,'n-of','urn:oasis:names:tc:xacml:1.0:function:n-of',18,0,0,2,-1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (244,'not','urn:oasis:names:tc:xacml:1.0:function:not',18,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (245,'any-of','urn:oasis:names:tc:xacml:3.0:function:any-of',18,0,1,2,-1,1,-1,1);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (246,'all-of','urn:oasis:names:tc:xacml:3.0:function:all-of',18,0,1,2,-1,1,-1,1);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (247,'any-of-any','urn:oasis:names:tc:xacml:3.0:function:any-of-any',18,0,1,2,-1,1,-1,0);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (248,'all-of-any','urn:oasis:names:tc:xacml:1.0:function:all-of-any',18,0,1,3,3,2,2,1);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (249,'any-of-all','urn:oasis:names:tc:xacml:1.0:function:any-of-all',18,0,1,3,3,2,2,1);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (250,'all-of-all','urn:oasis:names:tc:xacml:1.0:function:all-of-all',18,0,1,3,3,2,2,1);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (251,'map','urn:oasis:names:tc:xacml:3.0:function:map',NULL,1,1,2,-1,1,-1,1);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (252,'xpath-node-count','urn:oasis:names:tc:xacml:3.0:function:xpath-node-count',12,0,0,1,1,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (253,'xpath-node-equal','urn:oasis:names:tc:xacml:3.0:function:xpath-node-equal',18,0,0,2,2,NULL,NULL,NULL);
INSERT INTO FunctionDefinition (id, short_name, xacml_id, return_datatype, is_bag_return, is_higher_order, arg_lb, arg_ub, ho_arg_lb, ho_arg_ub, ho_primitive) VALUES (254,'xpath-node-match','urn:oasis:names:tc:xacml:3.0:function:xpath-node-match',18,0,0,2,2,NULL,NULL,NULL);

INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (1,0,1,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (2,0,1,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (3,0,2,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (4,0,2,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (5,0,3,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (6,1,4,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (7,1,5,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (8,0,6,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (9,0,6,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (10,0,7,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (11,0,7,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (12,0,8,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (13,0,8,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (14,0,9,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (15,0,9,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (16,0,10,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (17,0,11,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (18,0,12,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (19,0,13,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (20,0,14,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (21,0,15,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (22,0,16,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (23,0,17,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (24,0,18,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (25,0,19,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (26,0,20,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (27,0,21,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (28,0,22,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (29,0,23,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (30,0,24,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (31,0,25,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (32,0,26,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (33,0,27,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (34,0,28,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (35,0,29,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (36,0,30,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (37,0,31,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (38,0,32,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (39,0,33,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (40,0,34,1,22);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (41,0,35,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (42,0,36,1,17);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (43,0,37,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (44,0,37,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (45,0,38,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (46,0,38,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (47,0,39,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (48,0,39,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (49,0,40,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (50,0,40,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (51,0,41,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (52,0,41,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (53,0,41,3,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (54,0,42,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (55,0,42,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (56,0,42,3,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (57,0,43,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (58,0,43,2,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (59,0,44,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (60,0,44,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (61,0,45,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (62,0,45,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (63,0,46,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (64,0,46,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (65,0,47,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (66,0,47,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (67,0,48,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (68,0,48,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (69,0,49,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (70,0,49,2,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (71,0,50,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (72,0,50,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (73,0,51,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (74,0,51,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (75,0,52,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (76,0,52,2,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (77,0,53,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (78,0,53,2,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (79,0,54,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (80,0,54,2,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (81,0,55,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (82,0,55,2,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (83,0,56,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (84,0,56,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (85,0,57,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (86,0,57,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (89,0,58,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (90,0,58,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (91,0,59,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (92,0,59,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (93,0,60,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (94,0,60,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (95,0,61,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (96,0,61,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (97,0,62,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (98,0,62,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (99,0,63,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (100,0,63,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (101,0,64,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (102,0,65,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (103,0,66,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (104,0,67,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (125,0,68,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (126,0,69,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (128,0,70,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (129,0,71,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (130,0,71,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (131,0,72,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (132,0,72,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (133,0,73,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (134,0,73,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (135,0,74,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (136,0,74,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (137,0,75,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (138,0,75,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (139,0,76,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (140,0,76,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (141,0,77,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (142,0,77,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (143,0,78,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (144,0,78,2,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (145,0,79,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (146,0,79,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (147,0,80,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (148,0,80,2,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (149,0,81,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (150,0,81,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (151,0,82,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (152,0,82,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (153,0,83,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (154,0,83,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (155,0,84,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (156,0,84,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (157,0,85,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (158,0,85,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (159,0,86,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (160,0,86,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (161,0,87,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (162,0,87,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (163,0,88,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (164,0,88,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (165,0,89,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (166,0,89,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (167,0,90,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (168,0,90,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (169,0,91,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (170,0,91,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (171,0,92,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (172,0,92,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (173,0,93,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (174,0,93,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (175,0,94,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (176,0,94,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (177,0,95,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (178,0,95,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (179,0,96,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (180,0,96,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (181,0,97,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (182,0,97,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (183,0,98,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (184,0,98,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (185,0,99,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (186,0,99,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (187,0,100,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (188,0,100,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (189,1,101,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (190,1,102,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (191,0,103,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (192,1,103,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (193,0,104,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (194,1,105,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (195,0,106,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (196,1,106,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (197,0,107,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (198,1,108,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (199,0,109,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (200,1,109,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (201,0,110,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (202,1,111,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (203,1,112,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (204,0,113,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (205,1,113,2,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (206,0,114,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (207,1,115,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (208,1,116,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (209,0,117,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (210,1,117,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (211,0,118,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (212,1,119,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (213,1,120,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (214,0,121,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (215,1,121,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (216,0,122,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (217,1,123,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (218,1,124,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (219,0,125,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (220,1,125,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (221,0,126,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (222,1,127,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (223,1,128,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (224,0,129,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (225,1,129,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (226,0,130,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (227,1,131,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (228,1,132,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (229,0,133,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (230,1,133,2,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (231,0,134,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (232,1,135,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (233,1,136,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (234,0,137,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (235,1,137,2,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (236,0,138,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (237,1,139,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (238,1,140,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (239,0,141,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (240,1,141,2,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (241,0,142,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (242,1,143,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (243,1,144,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (244,1,145,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (245,0,145,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (246,0,146,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (247,1,147,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (248,1,148,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (249,0,149,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (250,1,149,2,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (251,0,150,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (252,1,151,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (253,1,152,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (254,0,153,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (255,1,153,2,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (256,0,154,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (257,1,155,1,22);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (258,1,156,1,22);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (259,0,157,1,22);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (260,1,157,2,22);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (261,0,158,1,22);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (262,1,159,1,17);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (263,1,160,1,17);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (264,0,161,1,17);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (265,1,161,2,17);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (266,0,162,1,17);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (267,0,163,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (268,0,163,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (269,0,164,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (270,0,164,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (271,0,165,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (272,0,165,2,22);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (273,0,166,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (274,0,166,2,17);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (275,0,167,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (276,0,167,2,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (277,0,168,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (278,0,168,2,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (279,1,169,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (280,1,169,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (281,1,170,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (282,1,170,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (283,1,171,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (284,1,172,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (285,1,172,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (286,1,173,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (287,1,173,2,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (288,1,174,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (289,1,174,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (290,1,175,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (292,1,176,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (293,1,176,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (294,1,177,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (295,1,177,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (296,1,178,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (297,1,178,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (298,1,179,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (299,1,180,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (300,1,180,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (301,1,181,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (302,1,181,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (303,1,182,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (304,1,182,2,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (305,1,183,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (306,1,183,2,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (307,1,184,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (308,1,185,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (309,1,185,2,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (310,1,186,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (311,1,186,2,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (312,1,187,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (313,1,187,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (314,1,188,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (315,1,188,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (316,1,189,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (317,1,190,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (318,1,190,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (319,1,191,1,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (320,1,191,2,16);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (321,1,192,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (322,1,192,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (323,1,193,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (324,1,193,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (325,1,194,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (326,1,195,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (327,1,195,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (328,1,196,1,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (329,1,196,2,21);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (330,1,197,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (331,1,197,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (332,1,198,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (333,1,198,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (334,1,199,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (335,1,200,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (336,1,200,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (337,1,201,1,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (338,1,201,2,19);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (339,1,202,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (340,1,202,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (341,1,203,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (342,1,203,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (343,1,204,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (344,1,205,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (345,1,205,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (346,1,206,1,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (347,1,206,2,27);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (348,1,207,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (349,1,207,2,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (350,1,208,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (351,1,208,2,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (352,1,209,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (353,1,210,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (354,1,210,2,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (355,1,211,1,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (356,1,211,2,24);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (357,1,212,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (358,1,212,2,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (359,1,213,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (360,1,213,2,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (361,1,214,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (362,1,215,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (363,1,215,2,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (364,1,216,1,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (365,1,216,2,13);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (366,1,217,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (367,1,217,2,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (368,1,218,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (369,1,218,2,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (370,1,219,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (371,1,220,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (372,1,220,2,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (373,1,221,1,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (374,1,221,2,15);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (375,1,222,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (376,1,222,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (377,1,223,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (378,1,223,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (380,1,224,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (381,1,225,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (382,1,225,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (383,1,226,2,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (384,1,226,1,23);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (385,1,227,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (386,1,227,2,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (387,1,228,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (388,1,228,2,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (389,1,229,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (390,1,230,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (391,1,230,2,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (392,1,231,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (393,1,231,2,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (394,1,232,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (395,1,232,2,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (396,1,233,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (397,1,233,2,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (398,1,234,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (399,1,235,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (400,1,235,2,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (401,1,236,1,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (402,1,236,2,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (403,0,237,1,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (404,0,237,2,14);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (405,0,238,1,26);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (406,0,238,2,20);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (407,1,239,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (408,1,239,2,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (409,1,240,1,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (410,1,240,2,25);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (411,0,241,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (412,0,242,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (413,0,243,1,12);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (414,0,243,2,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (415,0,244,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (416,0,245,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (417,0,245,2,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (418,1,245,3,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (419,0,246,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (420,0,246,2,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (421,1,246,3,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (422,0,247,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (423,1,247,2,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (424,1,247,3,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (433,0,248,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (434,1,248,2,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (435,1,248,3,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (436,0,249,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (437,1,249,2,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (438,1,249,3,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (439,0,250,1,18);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (440,1,250,2,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (441,1,250,3,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (442,0,251,1,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (447,1,251,2,NULL);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (448,0,252,1,28);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (449,0,253,1,28);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (450,0,253,2,28);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (451,0,254,1,28);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (452,0,254,2,28);
INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (453,0,92,3,16);

INSERT INTO PIPType VALUES (500,'SQL'), (501,'LDAP'), (502,'CSV'), (503,'Hyper-CSV'), (504,'Custom');

INSERT INTO GlobalRoleSettings (role, lockdown) values ('super-admin', '0');

INSERT INTO `ecomp_sdk`.`roles` (`id`, `loginid`, `role`) VALUES ('2', 'API', 'super-admin');
INSERT INTO `ecomp_sdk`.`roles` (`id`, `loginid`, `role`) VALUES ('3', 'demo', 'super-admin');

INSERT INTO `ecomp_sdk`.`USERINFO` (`loginid`, `NAME`) VALUES ('API', 'API');
INSERT INTO `ecomp_sdk`.`USERINFO` (`loginid`, `NAME`) VALUES ('demo', 'Demo');

INSERT INTO `ecomp_sdk`.`dcaeuuid` (`ID`, `name`, `description`) VALUES ('2', '/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer', 'vLoadBalancer');
INSERT INTO `ecomp_sdk`.`dcaeuuid` (`ID`, `name`, `description`) VALUES ('3', '/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall', 'vFirewall');

INSERT INTO `ecomp_sdk`.`microservicemodels` (`id`, `modelname`, `description`, `dependency`, `imported_by`, `attributes`, `ref_attributes`, `sub_attributes`, `version`) VALUES ('1', 'TcaMetrics', 'TCA Metrics test', '[NamedEntity,  DcaePolicyEntity]', 'API', 'functionalRole=java.lang.String:defaultValue-NA:required-false:MANY-false, name=java.lang.String:defaultValue-NA:required-false:MANY-false', 'thresholds=TcaThreshold:MANY-true', '{\"TcaThreshold\":{\"severity\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\",\"fieldPath\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\",\"thresholdValue\":\"java.lang.Integer:defaultValue-NA:required-false:MANY-false\",\"closedLoopControlName\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\",\"version\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\",\"direction\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\"}}', '1.0.0.5');
INSERT INTO `ecomp_sdk`.`microservicemodels` (`id`, `modelname`, `description`, `dependency`, `imported_by`, `ref_attributes`, `sub_attributes`, `version`) VALUES ('2', 'StringMatchingConfiguration', 'StringMatchingConfiguration', '[CdapServiceInstanceConfiguration]', 'API', 'serviceConfigurations=StringMatchingServiceConfiguration:MANY-true', '{\"StringMatchingServiceConfiguration\":{\"ageLimit\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\",\"timeWindow\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\",\"createClosedLoopEventId\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\",\"aaiSendFields\":\"java.lang.String:defaultValue-NA:required-false:MANY-true\",\"stringSet\":\"java.lang.String:defaultValue-NA:required-false:MANY-true\",\"outputEventName\":\"java.lang.String:defaultValue-NA:required-false:MANY-false\",\"aaiMatchingFields\":\"java.lang.String:defaultValue-NA:required-false:MANY-true\"}}', '1.0.0.3');

INSERT INTO `ecompname` VALUES (1,'demo','2016-12-28 14:23:31','DCAE','DCAE','demo','2016-12-28 14:23:31');
INSERT INTO `ecompname` VALUES (2,'demo','2016-12-28 14:23:31','test','SampleDemo','demo','2016-12-28 14:23:31');

INSERT INTO `safepolicywarning` VALUES (1,'demo','SampleRiskType','SampleSafePolicyWarning');

INSERT INTO `policyscopeclosedloop` VALUES (1,'SampleClosedLoop','demo');

INSERT INTO `policyscoperesource` VALUES (1,'SampleResource','demo');

INSERT INTO `policyscopeservice` VALUES (1,'SampleService','demo');

INSERT INTO `policyscopetype` VALUES (1,'SampleType','demo');

INSERT INTO `grouppolicyscopelist` VALUES (1,'PolicyScope_SampleGroupPolicyScope','resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop','demo');

INSERT INTO `microserviceconfigname` VALUES (1,'SampleConfigName','demo');

INSERT INTO `microservicelocation` VALUES (1,'SampleServiceLocation','demo');

INSERT INTO `risktype` VALUES (1,'demo','2016-12-29 20:20:48','demo','SampleRiskType','demo','2016-12-29 20:20:48');

INSERT INTO `policyentity` VALUES (3153,'doACPolicyPut','2017-02-09 17:13:37',0,'vFW Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:','doACPolicyPut','2017-02-09 17:13:37','<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:708de148-2cfb-4211-930a-44b446c2d781\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n    <Description>vFW Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:</Description>\n    <Target>\n        <AnyOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"PolicyName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DROOLS</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ECOMPName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">BRMS_PARAM_RULE</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ConfigName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskType\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskLevel\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"guard\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"TTLDate\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n        </AnyOf>\n    </Target>\n    <Rule RuleId=\"urn:com:xacml:rule:id:817128cd-2880-4e85-997b-1abff0eae822\" Effect=\"Permit\">\n        <Target>\n            <AnyOf>\n                <AllOf>\n                    <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n                        <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">ACCESS</AttributeValue>\n                        <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                    </Match>\n                    <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n                        <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Config</AttributeValue>\n                        <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                    </Match>\n                </AllOf>\n            </AnyOf>\n        </Target>\n        <AdviceExpressions>\n            <AdviceExpression AdviceId=\"BRMSPARAMID\" AppliesTo=\"Permit\">\n                <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Configuration</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"URLID\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URL/Config/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"PolicyName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"VersionNumber\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:ECOMPName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DROOLS</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:ConfigName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">BRMS_PARAM_RULE</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"key:controller\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">vFW</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"RiskType\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"RiskLevel\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"guard\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"TTLDate\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n                </AttributeAssignmentExpression>\n            </AdviceExpression>\n        </AdviceExpressions>\n    </Rule>\n</Policy>\n','Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml',0,'com',1,NULL,3152),(3155,'doACPolicyPut','2017-02-09 17:16:17',0,'vLB Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:','doACPolicyPut','2017-02-09 17:16:17','<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:95afb43f-13f2-475c-9501-7e022d15b8a7\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n    <Description>vLB Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:</Description>\n    <Target>\n        <AnyOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"PolicyName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DROOLS</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ECOMPName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">BRMS_PARAM_RULE</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ConfigName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskType\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskLevel\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"guard\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"TTLDate\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n        </AnyOf>\n    </Target>\n    <Rule RuleId=\"urn:com:xacml:rule:id:69f687f8-1f6e-485f-a4e8-5cb9beb28ba4\" Effect=\"Permit\">\n        <Target>\n            <AnyOf>\n                <AllOf>\n                    <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n                        <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">ACCESS</AttributeValue>\n                        <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                    </Match>\n                    <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n                        <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Config</AttributeValue>\n                        <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                    </Match>\n                </AllOf>\n            </AnyOf>\n        </Target>\n        <AdviceExpressions>\n            <AdviceExpression AdviceId=\"BRMSPARAMID\" AppliesTo=\"Permit\">\n                <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Configuration</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"URLID\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URL/Config/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"PolicyName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"VersionNumber\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:ECOMPName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DROOLS</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:ConfigName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">BRMS_PARAM_RULE</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"key:controller\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">vDNS</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"RiskType\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"RiskLevel\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"guard\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"TTLDate\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n                </AttributeAssignmentExpression>\n            </AdviceExpression>\n        </AdviceExpressions>\n    </Rule>\n</Policy>\n','Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml',0,'com',1,NULL,3154),(3157,'doACPolicyPut','2017-02-09 17:19:38',0,'Micro Service vFirewall Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:','doACPolicyPut','2017-02-09 17:19:38','<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:a1c91d9b-b5d2-4b04-b3a9-afcac74a8161\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n    <Description>Micro Service vFirewall Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:</Description>\n    <Target>\n        <AnyOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_MS_vFirewall.1.xml</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"PolicyName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DCAE</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ECOMPName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleConfigName</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ConfigName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">TcaMetrics-v1.0.0.5</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"service\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"uuid\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleServiceLocation</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"location\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskType\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskLevel\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"guard\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"TTLDate\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n        </AnyOf>\n    </Target>\n    <Rule RuleId=\"urn:com:xacml:rule:id:2af7b2a1-6427-4765-ac5f-0d5e3c7d059f\" Effect=\"Permit\">\n        <Target>\n            <AnyOf>\n                <AllOf>\n                    <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n                        <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">ACCESS</AttributeValue>\n                        <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                    </Match>\n                    <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n                        <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Config</AttributeValue>\n                        <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                    </Match>\n                </AllOf>\n            </AnyOf>\n        </Target>\n        <AdviceExpressions>\n            <AdviceExpression AdviceId=\"MSID\" AppliesTo=\"Permit\">\n                <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Configuration</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"URLID\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URL/Config/com.Config_MS_vFirewall.1.json</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"PolicyName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_MS_vFirewall.1.xml</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"VersionNumber\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:ECOMPName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DCAE</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:ConfigName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleConfigName</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:service\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">TcaMetrics-v1.0.0.5</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:uuid\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:Location\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleServiceLocation</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"Priority\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"RiskType\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"RiskLevel\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"guard\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"TTLDate\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n                </AttributeAssignmentExpression>\n            </AdviceExpression>\n        </AdviceExpressions>\n    </Rule>\n</Policy>\n','Config_MS_vFirewall.1.xml',0,'com',1,NULL,3156),(3159,'doACPolicyPut','2017-02-09 17:21:15',0,'Micro Service vLoadBalancer Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:','doACPolicyPut','2017-02-09 17:21:15','<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:4fd0d4bd-729b-42dd-9c39-d63fea7c9655\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n    <Description>Micro Service vLoadBalancer Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:</Description>\n    <Target>\n        <AnyOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_MS_vLoadBalancer.1.xml</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"PolicyName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n            <AllOf>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DCAE</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ECOMPName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleConfigName</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ConfigName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">TcaMetrics-v1.0.0.5</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"service\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"uuid\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleServiceLocation</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"location\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskType\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskLevel\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"guard\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n                <Match MatchId=\"org.openecomp.function.regex-match\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n                    <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"TTLDate\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                </Match>\n            </AllOf>\n        </AnyOf>\n    </Target>\n    <Rule RuleId=\"urn:com:xacml:rule:id:69d31737-09d4-429f-9e1d-6bcf39da90a1\" Effect=\"Permit\">\n        <Target>\n            <AnyOf>\n                <AllOf>\n                    <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n                        <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">ACCESS</AttributeValue>\n                        <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                    </Match>\n                    <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n                        <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Config</AttributeValue>\n                        <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n                    </Match>\n                </AllOf>\n            </AnyOf>\n        </Target>\n        <AdviceExpressions>\n            <AdviceExpression AdviceId=\"MSID\" AppliesTo=\"Permit\">\n                <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Configuration</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"URLID\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URL/Config/com.Config_MS_vLoadBalancer.1.json</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"PolicyName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_MS_vLoadBalancer.1.xml</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"VersionNumber\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:ECOMPName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DCAE</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:ConfigName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleConfigName</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:service\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">TcaMetrics-v1.0.0.5</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:uuid\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"matching:Location\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleServiceLocation</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"Priority\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"RiskType\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"RiskLevel\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"guard\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n                </AttributeAssignmentExpression>\n                <AttributeAssignmentExpression AttributeId=\"TTLDate\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n                    <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n                </AttributeAssignmentExpression>\n            </AdviceExpression>\n        </AdviceExpressions>\n    </Rule>\n</Policy>\n','Config_MS_vLoadBalancer.1.xml',0,'com',1,NULL,3158);

INSERT INTO `configurationdataentity` VALUES (3152,'/* Autogenerated Code Please Don\'t change/remove this comment section. This is for the UI purpose. \n	 <$%BRMSParamTemplate=ControlLoopDemo__closedLoopControlName%$> \n */ \n\r\n\r\n/*-\r\n * ============LICENSE_START=======================================================\r\n * archetype-closed-loop-demo-rules\r\n * ================================================================================\r\n * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r\n * ================================================================================\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * ============LICENSE_END=========================================================\r\n */\r\n\r\npackage org.openecomp.policy.controlloop;\r\n\r\nimport java.util.LinkedList;\r\nimport java.util.Map;\r\nimport java.util.HashMap;\r\nimport java.util.UUID;\r\n\r\nimport org.openecomp.policy.controlloop.VirtualControlLoopEvent;\r\nimport org.openecomp.policy.controlloop.ControlLoopEventStatus;\r\nimport org.openecomp.policy.controlloop.VirtualControlLoopNotification;\r\nimport org.openecomp.policy.controlloop.ControlLoopNotificationType;\r\nimport org.openecomp.policy.controlloop.ControlLoopOperation;\r\nimport org.openecomp.policy.controlloop.ControlLoopOperationWrapper;\r\nimport org.openecomp.policy.template.demo.ControlLoopException;\r\n\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199CloudRegion;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperties;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperty;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199GenericVNF;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InstanceFilters;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Manager;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199NamedQuery;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199QueryParameters;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Request;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199RequestWrapper;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Response;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ResponseWrapper;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ServiceInstance;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Tenant;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199VfModule;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199VServer;\r\nimport org.openecomp.policy.aai.util.Serialization;\r\n\r\nimport org.openecomp.policy.appc.CommonHeader;\r\nimport org.openecomp.policy.appc.Request;\r\nimport org.openecomp.policy.appc.Response;\r\nimport org.openecomp.policy.appc.ResponseCode;\r\nimport org.openecomp.policy.appc.ResponseStatus;\r\nimport org.openecomp.policy.appc.ResponseValue;\r\n\r\nimport org.openecomp.policy.template.demo.EventManager;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGRequest;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGStream;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGStreams;\r\n\r\nimport org.openecomp.policy.mso.MSOManager;\r\nimport org.openecomp.policy.mso.MSORequest;\r\nimport org.openecomp.policy.mso.MSORequestStatus;\r\nimport org.openecomp.policy.mso.MSORequestDetails;\r\nimport org.openecomp.policy.mso.MSOModelInfo;\r\nimport org.openecomp.policy.mso.MSOCloudConfiguration;\r\nimport org.openecomp.policy.mso.MSORequestInfo;\r\nimport org.openecomp.policy.mso.MSORequestParameters;\r\nimport org.openecomp.policy.mso.MSORelatedInstanceListElement;\r\nimport org.openecomp.policy.mso.MSORelatedInstance;\r\nimport org.openecomp.policy.mso.MSOResponse;\r\n\r\nimport org.openecomp.policy.drools.system.PolicyEngine;\r\n\r\n//\r\n// These parameters are required to build the runtime policy\r\n//\r\ndeclare Params\r\n    closedLoopControlName : String\r\n    actor : String\r\n    aaiURL : String\r\n    aaiUsername : String\r\n    aaiPassword : String\r\n    msoURL : String\r\n    msoUsername : String\r\n    msoPassword : String\r\n    aaiNamedQueryUUID : String\r\n    aaiPatternMatch : int \r\n    notificationTopic : String\r\n    appcTopic : String\r\nend\r\n\r\n/*\r\n*\r\n* Called once and only once to insert the parameters into working memory for this Closed Loop policy.\r\n* (Comment SETUP rule out for the first ECOMP opensource release since policy BRMS_GW already puts a Params fact in there)\r\n*\r\n*\r\n*rule \"BRMSParamvFWDemoPolicy.SETUP\"\r\n*	when\r\n*	then\r\n*		System.out.println(\"rule SETUP is triggered.\");\r\n*		Params params = new Params();\r\n*		params.setClosedLoopControlName(\"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\");\r\n*		params.setActor(\"APPC\");\r\n*		params.setAaiURL(\"null\");\r\n*		params.setAaiUsername(\"null\");\r\n*		params.setAaiPassword(\"null\");\r\n*		params.setMsoURL(\"null\");\r\n*		params.setMsoUsername(\"null\");\r\n*		params.setMsoPassword(\"null\");\r\n*		params.setAaiNamedQueryUUID(\"null\");\r\n*		params.setAaiPatternMatch(1);\r\n*		params.setNotificationTopic(\"POLICY-CL-MGT\");\r\n*		params.setAppcTopic(\"APPC-CL\");\r\n*		//\r\n*		// This stays in memory as long as the rule is alive and running\r\n*		//\r\n*		insert(params);\r\n*end\r\n*/\r\n/*\r\n*\r\n* This rule responds to DCAE Events\r\n*\r\n*/\r\nrule \"BRMSParamvFWDemoPolicy.EVENT\"\r\n	when\r\n        $params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n        $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n        not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))\r\n	then\r\n		System.out.println(\"rule EVENT is triggered.\");\r\n		try {\r\n			// \r\n			// Check the requestID in the event to make sure it is not null before we create the EventManager. \r\n			// The EventManager will do extra syntax checking as well check if the closed loop is disabled/\r\n			//\r\n			if ($event.requestID == null) {\r\n				VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n				notification.notification = ControlLoopNotificationType.REJECTED;\r\n				notification.from = \"policy\";\r\n				notification.message = \"Missing requestID from DCAE event\";\r\n				notification.policyName = drools.getRule().getName();\r\n				notification.policyScope = \"com\";\r\n				notification.policyVersion = \"1\";\r\n				//\r\n				// Let interested parties know\r\n				//\r\n				try {\r\n					System.out.println(Serialization.gsonPretty.toJson(notification));\r\n					PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n				} catch (Exception e) {\r\n					e.printStackTrace();\r\n					System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				}\r\n				//\r\n				// Retract it from memory\r\n				//\r\n				retract($event);\r\n				System.out.println(\"Event with requestID=null has been retracted.\");\r\n			} else {\r\n				//\r\n				// Create an EventManager\r\n				//\r\n				EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);\r\n				//\r\n				// Determine if EventManager can actively process the event (i.e. syntax)\r\n				//\r\n				VirtualControlLoopNotification notification = manager.activate($event);\r\n				notification.from = \"policy\"; \r\n				notification.policyName = drools.getRule().getName();\r\n				notification.policyScope = \"com\";\r\n				notification.policyVersion = \"1\";\r\n				//\r\n				// Are we actively pursuing this event?\r\n				//\r\n				if (notification.notification == ControlLoopNotificationType.ACTIVE) {\r\n					//\r\n					// Insert Event Manager into memory, this will now kick off processing.\r\n					//\r\n					insert(manager);\r\n					//\r\n					// Let interested parties know\r\n					//\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						e.printStackTrace();\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n					}		\r\n				} else {\r\n					//\r\n					// Let interested parties know\r\n					//\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						e.printStackTrace();\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n					}\r\n					//\r\n					// Retract it from memory\r\n					//\r\n					retract($event);\r\n				}\r\n				//\r\n				// Now that the manager is inserted into Drools working memory, we\'ll wait for\r\n				// another rule to fire in order to continue processing. This way we can also\r\n				// then screen for additional ONSET and ABATED events for this same RequestIDs \r\n				// and for different RequestIDs but with the same closedLoopControlName and target.\r\n				//\r\n			}\r\n		//\r\n		} catch (Exception e) {\r\n			e.printStackTrace();\r\n			VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n			notification.notification = ControlLoopNotificationType.REJECTED;\r\n			notification.message = \"Exception occurred \" + e.getMessage();\r\n			notification.policyName = drools.getRule().getName();\r\n			notification.policyScope = \"com\";\r\n			notification.policyVersion = \"1\";\r\n			//\r\n			//\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e1) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e1.printStackTrace();\r\n			}\r\n			//\r\n			// Retract the event\r\n			//\r\n			retract($event);\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager\r\n* is created. We can start the operations for this closed loop.\r\n*\r\n*/\r\nrule \"BRMSParamvFWDemoPolicy.EVENT.MANAGER\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER is triggered.\");\r\n		//\r\n		// Check which event this is.\r\n		//\r\n		EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);\r\n		//\r\n		// We only want the initial ONSET event in memory,\r\n		// all the other events need to be retracted to support\r\n		// cleanup and avoid the other rules being fired for this event.\r\n		//\r\n		if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {\r\n			System.out.println(\"Retracting \"+eventStatus+\" Event.\");\r\n			retract($event);\r\n			return;\r\n		}\r\n		//\r\n		// Now the event in memory is first onset event\r\n		//\r\n		try {\r\n			//\r\n			// Pull the known AAI field from the Event\r\n			//\r\n			// generic-vnf is needed for vFirewall case\r\n			// vserver-name is needed for vLoadBalancer case\r\n			//\r\n			String genericVNF = $event.AAI.get(\"generic-vnf.vnf-id\");\r\n			String vserver = $event.AAI.get(\"vserver.vserver-name\");\r\n			//\r\n			// Check if we are implementing a simple pattern match.\r\n			//\r\n			if ($params.getAaiPatternMatch() == 1) {\r\n				//\r\n				// Yes\r\n				//\r\n				//Basic naming characteristics:\r\n				//VF Name (9 char)+VM name (13 char total)+VFC (19 char total)\r\n				//Example: \r\n				//VF Name (9 characters):    cscf0001v\r\n				//VM Name(13 characters): cscf0001vm001\r\n				//VFC name(19 characters): cscf0001vm001cfg001\r\n				//\r\n				// zdfw1fwl01fwl02 or zdfw1fwl01fwl01  \r\n				// replaced with\r\n				// zdfw1fwl01pgn02 or zdfw1fwl01pgn01\r\n				//\r\n				int index = genericVNF.lastIndexOf(\"fwl\");\r\n				if (index == -1) {\r\n					System.err.println(\"The generic-vnf.vnf-id from DCAE Event is not valid.\");\r\n				} else {\r\n					genericVNF = genericVNF.substring(0, index) + \"pgn\" + genericVNF.substring(index+\"fwl\".length());\r\n				}\r\n				//\r\n				// Construct an APPC request\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"ModifyConfig\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// insert operationWrapper into memory\r\n				//\r\n				insert(operationWrapper);\r\n				//\r\n				Request request = new Request();\r\n				request.CommonHeader = new CommonHeader();\r\n				request.CommonHeader.RequestID = $event.requestID;\r\n				request.Action = operation.operation;\r\n				request.Payload = new HashMap<String, Object>();\r\n				//\r\n				// Fill in the payload\r\n				//\r\n				request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\r\n				//\r\n				PGRequest pgRequest = new PGRequest();\r\n				pgRequest.pgStreams = new PGStreams();\r\n				\r\n				PGStream pgStream;\r\n				for(int i = 0; i < 5; i++){\r\n					pgStream = new PGStream();\r\n					pgStream.streamId = \"fw_udp\"+(i+1);\r\n					pgStream.isEnabled = \"true\";\r\n					pgRequest.pgStreams.pgStream.add(pgStream);\r\n				}\r\n				request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\r\n				\r\n				if (request != null) {\r\n					//\r\n					// Insert request into memory\r\n					//\r\n					insert(request);\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					// message and history ??\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"com\";\r\n					notification.policyVersion = \"1\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Now send the operation request\r\n					//\r\n					if (request instanceof Request) {\r\n						try {\r\n							System.out.println(\"APPC request sent:\");\r\n							System.out.println(Serialization.gsonPretty.toJson(request));\r\n							PolicyEngine.manager.deliver($params.getAppcTopic(), request);\r\n						} catch (Exception e) {\r\n							e.printStackTrace();\r\n							System.out.println(\"Can\'t deliver request: \" + request);\r\n						}\r\n					}\r\n				} else {\r\n					//\r\n					// what happens if it is null\r\n					//\r\n				}\r\n				//\r\n			} else {\r\n				//\r\n				// create AAI named-query request with UUID started with \"F199\"\r\n				//\r\n				AAINQF199Request aainqf199request = new AAINQF199Request();\r\n				AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();\r\n				AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();\r\n				AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();\r\n				//\r\n				// queryParameters\r\n				//\r\n				aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID()); \r\n				aainqf199queryparam.namedQuery = aainqf199namedquery;\r\n				aainqf199request.queryParameters = aainqf199queryparam;\r\n				//\r\n				// instanceFilters\r\n				//\r\n				Map aainqf199instancefiltermap = new HashMap();\r\n				Map aainqf199instancefiltermapitem = new HashMap();\r\n				aainqf199instancefiltermapitem.put(\"vserver-name\", vserver); \r\n				aainqf199instancefiltermap.put(\"vserver\", aainqf199instancefiltermapitem);\r\n				aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);\r\n				aainqf199request.instanceFilters = aainqf199instancefilter;\r\n				//\r\n				// print aainqf199request for debug\r\n				//\r\n				System.out.println(\"AAI Request sent:\");\r\n				System.out.println(Serialization.gsonPretty.toJson(aainqf199request));\r\n				//\r\n				// Create AAINQF199RequestWrapper\r\n				//\r\n				AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);\r\n				//\r\n				// insert aainqf199request into memory\r\n				//\r\n				insert(aainqf199RequestWrapper);\r\n			}\r\n			//\r\n		} catch (Exception e) {\r\n		 e.printStackTrace();\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager\r\n* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.\r\n*\r\n*/\r\nrule \"BRMSParamvFWDemoPolicy.EVENT.MANAGER.AAINQF199REQUEST\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER.AAINQF199REQUEST is triggered.\");\r\n		//\r\n		// send the request\r\n		//\r\n		AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),\r\n													   $aainqf199RequestWrapper.aainqf199request, $event.requestID);\r\n		//\r\n		// Check AAI response\r\n		//\r\n		if (aainqf199response == null) {\r\n			System.err.println(\"Failed to get AAI response\");\r\n			//\r\n			// Fail and retract everything\r\n			//\r\n			retract($event);\r\n			retract($manager);\r\n			retract($aainqf199RequestWrapper);\r\n		} else {\r\n			//\r\n			// Create AAINQF199ResponseWrapper\r\n			//\r\n			AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);\r\n			//\r\n			// insert aainqf199ResponseWrapper to memeory\r\n			//\r\n			insert(aainqf199ResponseWrapper);\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.\r\n*\r\n*/\r\nrule \"BRMSParamvFWDemoPolicy.EVENT.MANAGER.AAINQF199RESPONSE\"\r\n	when \r\n		$params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\r\n		$aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.\");\r\n		//\r\n		// Extract related fields out of AAINQF199RESPONSE\r\n		//\r\n		String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName, \r\n		       vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,\r\n		       serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,\r\n		       vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName, \r\n		       vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;\r\n		try {\r\n			//\r\n			// vnfItem\r\n			//\r\n			vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;\r\n			vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;\r\n			vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf(\"/\")+1);\r\n			vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;\r\n			vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;\r\n			vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\r\n			vnfItemModelVersion = 		$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;\r\n			vnfItemModelNameVersionId = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// serviceItem\r\n			//\r\n			serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;\r\n			serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;\r\n			serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\r\n			serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;\r\n			serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;\r\n			serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// This comes from the base module\r\n			//\r\n			vfModuleItemVfModuleName = 			$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).vfModule.vfModuleName;\r\n			vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace(\"Vfmodule\", \"vDNS\");\r\n			//\r\n			// vfModuleItem - NOT the base module\r\n			//\r\n			vfModuleItemPersonaModelId = 		$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).vfModule.personaModelId;\r\n			vfModuleItemPersonaModelVersion = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).vfModule.personaModelVersion;\r\n			vfModuleItemModelName = 				$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).extraProperties.extraProperty.get(0).propertyValue;\r\n			vfModuleItemModelNameVersionId = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// tenantItem\r\n			//\r\n			tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;\r\n			//\r\n			// cloudRegionItem\r\n			//\r\n			cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;\r\n			//\r\n		} catch (Exception e) {\r\n			e.printStackTrace();\r\n			VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n			notification.notification = ControlLoopNotificationType.REJECTED;\r\n			notification.message = \"Exception occurred \" + e.getMessage();\r\n			notification.policyName = drools.getRule().getName();\r\n			notification.policyScope = \"com\";\r\n			notification.policyVersion = \"1\";\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e1) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e1.printStackTrace();\r\n			}\r\n			//\r\n			notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n			notification.message = \"Invalid named-query response from AAI\";\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n                PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e1) {\r\n                System.out.println(\"Can\'t deliver notification: \" + notification);\r\n                e1.printStackTrace();\r\n            }\r\n			//\r\n			// Retract everything\r\n			//\r\n			retract($aainqf199RequestWrapper);\r\n			retract($aainqf199ResponseWrapper);\r\n			retract($manager);\r\n			retract($event);\r\n			return;\r\n		}	\r\n		//\r\n		// Extracted fields should not be null\r\n		//\r\n		if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||\r\n		    (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||\r\n		    (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||\r\n		    (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||\r\n		    (serviceItemModelType == null) || (serviceItemModelVersion == null) ||\r\n		    (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||\r\n		    (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||\r\n		    (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||\r\n		    (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {\r\n			//\r\n			System.err.println(\"some fields are missing from AAI response.\");\r\n			//\r\n			// Fail and retract everything\r\n			//\r\n			retract($aainqf199RequestWrapper);\r\n			retract($aainqf199ResponseWrapper);\r\n			retract($manager);\r\n			retract($event);\r\n			return;\r\n		}\r\n		//\r\n		// We don\'t need them any more\r\n		//\r\n		retract($aainqf199ResponseWrapper);\r\n		retract($aainqf199RequestWrapper);  \r\n		//\r\n		// check the actor of this closed loop\r\n		//\r\n		switch ($params.getActor()) {\r\n			case \"APPC\":\r\n			{\r\n				//\r\n				// Construct an APPC request\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"ModifyConfig\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// insert operationWrapper into memory\r\n				//\r\n				insert(operationWrapper);\r\n				//\r\n				Request request = new Request();\r\n				request.CommonHeader = new CommonHeader();\r\n				request.CommonHeader.RequestID = $event.requestID;\r\n				request.Action = operation.operation;\r\n				request.Payload = new HashMap<String, Object>();\r\n				//\r\n				// Fill in the payload\r\n				// Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case\r\n				//\r\n				String genericVNF = \"zdfw1fwl01pgn02\";\r\n				request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\r\n				//\r\n				PGRequest pgRequest = new PGRequest();\r\n				pgRequest.pgStreams = new PGStreams();\r\n				\r\n				PGStream pgStream;\r\n				for(int i = 0; i < 5; i++){\r\n					pgStream = new PGStream();\r\n					pgStream.streamId = \"fw_udp\"+(i+1);\r\n					pgStream.isEnabled = \"true\";\r\n					pgRequest.pgStreams.pgStream.add(pgStream);\r\n				}\r\n				request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\r\n				\r\n				if (request != null) {\r\n					//\r\n					// Insert request into memory\r\n					//\r\n					insert(request);\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					// message and history ??\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"com\";\r\n					notification.policyVersion = \"1\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Now send the operation request\r\n					//\r\n					if (request instanceof Request) {\r\n						try {\r\n							System.out.println(\"APPC request sent:\");\r\n							System.out.println(Serialization.gsonPretty.toJson(request));\r\n							PolicyEngine.manager.deliver($params.getAppcTopic(), request);\r\n						} catch (Exception e) {\r\n							e.printStackTrace();\r\n							System.out.println(\"Can\'t deliver request: \" + request);\r\n						}\r\n					}\r\n				} else {\r\n					//\r\n					// what happens if it is null\r\n					//\r\n				}\r\n			}\r\n			break;\r\n			case \"MSO\":\r\n			{\r\n				//\r\n				// Construct an operation\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"createModuleInstance\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// Construct an MSO request\r\n				//\r\n				MSORequest request = new MSORequest();\r\n				request.requestDetails = new MSORequestDetails();\r\n				request.requestDetails.modelInfo = new MSOModelInfo();\r\n				request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();\r\n				request.requestDetails.requestInfo = new MSORequestInfo();\r\n				request.requestDetails.requestParameters = new MSORequestParameters();\r\n				request.requestDetails.requestParameters.userParams = null;\r\n				//\r\n				// cloudConfiguration\r\n				//\r\n				request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;\r\n				request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;\r\n				//\r\n				// modelInfo\r\n				//\r\n				request.requestDetails.modelInfo.modelType = \"vfModule\";\r\n				request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;\r\n				request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;\r\n				request.requestDetails.modelInfo.modelName = vfModuleItemModelName;\r\n				request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;\r\n				//\r\n				// requestInfo\r\n				//\r\n				request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;\r\n				request.requestDetails.requestInfo.source = \"POLICY\";\r\n				request.requestDetails.requestInfo.suppressRollback = false;\r\n				//\r\n				// relatedInstanceList\r\n				//\r\n				MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();\r\n				MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();\r\n				relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();\r\n				relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();\r\n				//\r\n				relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelType = \"service\";\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;\r\n				//\r\n				relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelType = \"vnf\";\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;\r\n				//	\r\n				request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);\r\n				request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);\r\n				//\r\n				// print MSO request for debug\r\n				//\r\n				System.out.println(\"MSO request sent:\");\r\n				System.out.println(Serialization.gsonPretty.toJson(request));\r\n				//\r\n				//\r\n				//\r\n				if (request != null) {\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"com\";\r\n					notification.policyVersion = \"1\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL\r\n					//\r\n					String MSOUrl = $params.getMsoURL() + \"/serviceInstances/v2/\" + serviceItemServiceInstanceId + \"/vnfs/\" + vnfItemVnfId + \"/vfModules\";\r\n					//\r\n					// Call MSO\r\n					//\r\n					MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);\r\n					//\r\n					if (response != null) {\r\n						//\r\n						// Assign requestId\r\n						//\r\n						request.requestId = $event.requestID.toString();						\r\n						response.request.requestId = $event.requestID.toString();\r\n						//\r\n						// Insert facts\r\n						//\r\n						insert(operationWrapper);\r\n						insert(request);\r\n						insert(response);\r\n					} else {\r\n						//\r\n						// MSO request not even accepted\r\n						//\r\n						notification.message = operationWrapper.operation.toMessage();\r\n						operationWrapper.operation.message = operationWrapper.operation.toMessage();\r\n						operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n						$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n						notification.history.add(operationWrapper.operation);\r\n						notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n						//\r\n						// Let interested parties know\r\n						//\r\n						try {\r\n							System.out.println(Serialization.gsonPretty.toJson(notification));\r\n							PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n						} catch (Exception e) {\r\n							System.out.println(\"Can\'t deliver notification: \" + notification);\r\n							e.printStackTrace();\r\n						}\r\n	                    notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n                        try {\r\n                        	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n                        	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n                        } catch (Exception e) {\r\n                        	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n                        	e.printStackTrace();\r\n                        }\r\n						//\r\n						// Retract everything\r\n						//\r\n						retract($event);\r\n						retract($manager);\r\n					}\r\n				} else {\r\n					System.err.println(\"constructed MSO request is invalid.\");\r\n				}\r\n			}\r\n			break; \r\n		} \r\nend\r\n		\r\n/*\r\n*\r\n* This rule responds to APPC Response Events\r\n*\r\n*/\r\nrule \"BRMSParamvFWDemoPolicy.APPC.RESPONSE\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\r\n		$request : Request( getCommonHeader().RequestID == $event.requestID )\r\n		$response : Response( getCommonHeader().RequestID == $event.requestID )	\r\n	then\r\n		System.out.println(\"rule APPC.RESPONSE is triggered.\");\r\n		if ($response.Status == null) {\r\n			$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n			$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n		} \r\n		//\r\n		// Get the Response Code\r\n		//\r\n		ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);\r\n		if (code == null) {\r\n			$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n			$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n		}\r\n		//\r\n		// Construct notification\r\n		//\r\n		VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n		notification.from = \"policy\";\r\n		notification.policyName = drools.getRule().getName();\r\n		notification.policyScope = \"com\";\r\n		notification.policyVersion = \"1\";\r\n		notification.message = $operationWrapper.operation.toMessage();\r\n		$operationWrapper.operation.message = $operationWrapper.operation.toMessage();\r\n		//\r\n		// Ok, let\'s figure out what APP-C\'s response is\r\n		//\r\n		switch (code) {\r\n			case ACCEPT:\r\n				$operationWrapper.operation.outcome = \"PROCESSING\";\r\n				break;\r\n			case ERROR:\r\n			case REJECT:\r\n				$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n				$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n				break;\r\n			case SUCCESS:\r\n				$operationWrapper.operation.outcome = \"SUCCESS\";\r\n				$manager.setControlLoopResult(\"SUCCESS\");\r\n				break;\r\n			case FAILURE:\r\n				$operationWrapper.operation.outcome = \"FAILURE\";\r\n				$manager.setControlLoopResult(\"FAILURE\");\r\n				break;\r\n		}\r\n		if ($operationWrapper.operation.outcome.equals(\"SUCCESS\")) {\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n            notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n\r\n			//\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		} else if ($operationWrapper.operation.outcome.equals(\"PROCESSING\")) {\r\n			retract($response);\r\n		} else {\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n            notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n			//\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		}\r\n		\r\nend		\r\n\r\n/*\r\n*\r\n* This rule is used to clean up APPC response\r\n*\r\n*/		\r\nrule \"BRMSParamvFWDemoPolicy.APPC.RESPONSE.CLEANUP\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n        $response : Response($id : getCommonHeader().RequestID )\r\n		not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) ) \r\n	then\r\n		System.out.println(\"rule APPC.RESPONSE.CLEANUP is triggered.\");\r\n		retract($response);\r\nend\r\n\r\n/*\r\n*\r\n* This rule responds to MSO Response Events\r\n*\r\n*/\r\nrule \"BRMSParamvFWDemoPolicy.MSO.RESPONSE\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\r\n		$request : MSORequest( requestId == $event.requestID.toString() )\r\n		$response : MSOResponse( request.requestId == $event.requestID.toString() )	\r\n	then\r\n		System.out.println(\"rule MSO.RESPONSE is triggered.\");\r\n		//\r\n		// Construct notification\r\n		//\r\n		VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n		notification.from = \"policy\";\r\n		notification.policyName = drools.getRule().getName();\r\n		notification.policyScope = \"com\";\r\n		notification.policyVersion = \"1\";\r\n		notification.message = $operationWrapper.operation.toMessage();\r\n		$operationWrapper.operation.message = $operationWrapper.operation.toMessage();\r\n		//\r\n		// The operation can either be succeeded or failed\r\n		// \r\n		if($response.request.requestStatus.requestState.equals(\"Completed\")) {\r\n			$operationWrapper.operation.outcome = \"SUCCESS\";\r\n			$manager.setControlLoopResult(\"SUCCESS\");\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n			notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n            //\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		} else {\r\n			$operationWrapper.operation.outcome = \"FAILURE\";\r\n			$manager.setControlLoopResult(\"FAILURE\");\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n			notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n            //\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		}\r\n		\r\nend	\nrule \"Params\" \n	salience 1000 \n	when\n	then\n		Params params = new Params();\n		params.setAaiPatternMatch(1);\n		params.setAppcTopic(\"APPC-CL\");\n		params.setAaiURL(\"null\");\n		params.setMsoPassword(\"null\");\n		params.setClosedLoopControlName(\"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\");\n		params.setAaiUsername(\"null\");\n		params.setMsoURL(\"null\");\n		params.setActor(\"APPC\");\n		params.setMsoUsername(\"null\");\n		params.setAaiNamedQueryUUID(\"null\");\n		params.setAaiPassword(\"null\");\n		params.setNotificationTopic(\"POLICY-CL-MGT\");\n		insert(params);\nend\r\n','OTHER','com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt','doACPolicyPut','2017-02-09 17:13:37',0,'','doACPolicyPut','2017-02-09 17:13:37',1),(3154,'/* Autogenerated Code Please Don\'t change/remove this comment section. This is for the UI purpose. \n	 <$%BRMSParamTemplate=ControlLoopDemo__closedLoopControlName%$> \n */ \n\r\n\r\n/*-\r\n * ============LICENSE_START=======================================================\r\n * archetype-closed-loop-demo-rules\r\n * ================================================================================\r\n * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r\n * ================================================================================\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * ============LICENSE_END=========================================================\r\n */\r\n\r\npackage org.openecomp.policy.controlloop;\r\n\r\nimport java.util.LinkedList;\r\nimport java.util.Map;\r\nimport java.util.HashMap;\r\nimport java.util.UUID;\r\n\r\nimport org.openecomp.policy.controlloop.VirtualControlLoopEvent;\r\nimport org.openecomp.policy.controlloop.ControlLoopEventStatus;\r\nimport org.openecomp.policy.controlloop.VirtualControlLoopNotification;\r\nimport org.openecomp.policy.controlloop.ControlLoopNotificationType;\r\nimport org.openecomp.policy.controlloop.ControlLoopOperation;\r\nimport org.openecomp.policy.controlloop.ControlLoopOperationWrapper;\r\nimport org.openecomp.policy.template.demo.ControlLoopException;\r\n\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199CloudRegion;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperties;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperty;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199GenericVNF;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InstanceFilters;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Manager;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199NamedQuery;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199QueryParameters;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Request;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199RequestWrapper;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Response;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ResponseWrapper;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ServiceInstance;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Tenant;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199VfModule;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199VServer;\r\nimport org.openecomp.policy.aai.util.Serialization;\r\n\r\nimport org.openecomp.policy.appc.CommonHeader;\r\nimport org.openecomp.policy.appc.Request;\r\nimport org.openecomp.policy.appc.Response;\r\nimport org.openecomp.policy.appc.ResponseCode;\r\nimport org.openecomp.policy.appc.ResponseStatus;\r\nimport org.openecomp.policy.appc.ResponseValue;\r\n\r\nimport org.openecomp.policy.template.demo.EventManager;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGRequest;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGStream;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGStreams;\r\n\r\nimport org.openecomp.policy.mso.MSOManager;\r\nimport org.openecomp.policy.mso.MSORequest;\r\nimport org.openecomp.policy.mso.MSORequestStatus;\r\nimport org.openecomp.policy.mso.MSORequestDetails;\r\nimport org.openecomp.policy.mso.MSOModelInfo;\r\nimport org.openecomp.policy.mso.MSOCloudConfiguration;\r\nimport org.openecomp.policy.mso.MSORequestInfo;\r\nimport org.openecomp.policy.mso.MSORequestParameters;\r\nimport org.openecomp.policy.mso.MSORelatedInstanceListElement;\r\nimport org.openecomp.policy.mso.MSORelatedInstance;\r\nimport org.openecomp.policy.mso.MSOResponse;\r\n\r\nimport org.openecomp.policy.drools.system.PolicyEngine;\r\n\r\n//\r\n// These parameters are required to build the runtime policy\r\n//\r\ndeclare Params\r\n    closedLoopControlName : String\r\n    actor : String\r\n    aaiURL : String\r\n    aaiUsername : String\r\n    aaiPassword : String\r\n    msoURL : String\r\n    msoUsername : String\r\n    msoPassword : String\r\n    aaiNamedQueryUUID : String\r\n    aaiPatternMatch : int \r\n    notificationTopic : String\r\n    appcTopic : String\r\nend\r\n\r\n/*\r\n*\r\n* Called once and only once to insert the parameters into working memory for this Closed Loop policy.\r\n* (Comment SETUP rule out for the first ECOMP opensource release since policy BRMS_GW already puts a Params fact in there)\r\n*\r\n*\r\n*rule \"BRMSParamvLBDemoPolicy.SETUP\"\r\n*	when\r\n*	then\r\n*		System.out.println(\"rule SETUP is triggered.\");\r\n*		Params params = new Params();\r\n*		params.setClosedLoopControlName(\"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\");\r\n*		params.setActor(\"MSO\");\r\n*		params.setAaiURL(\"https://aai.api.simpledemo.openecomp.org:8443\");\r\n*		params.setAaiUsername(\"POLICY\");\r\n*		params.setAaiPassword(\"POLICY\");\r\n*		params.setMsoURL(\"http://vm1.mso.simpledemo.openecomp.org:8080/ecomp/mso/infra\");\r\n*		params.setMsoUsername(\"InfraPortalClient\");\r\n*		params.setMsoPassword(\"password1$\");\r\n*		params.setAaiNamedQueryUUID(\"f199cb88-5e69-4b1f-93e0-6f257877d066\");\r\n*		params.setAaiPatternMatch(0);\r\n*		params.setNotificationTopic(\"POLICY-CL-MGT\");\r\n*		params.setAppcTopic(\"APPC-CL\");\r\n*		//\r\n*		// This stays in memory as long as the rule is alive and running\r\n*		//\r\n*		insert(params);\r\n*end\r\n*/\r\n/*\r\n*\r\n* This rule responds to DCAE Events\r\n*\r\n*/\r\nrule \"BRMSParamvLBDemoPolicy.EVENT\"\r\n	when\r\n        $params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n        $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n        not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))\r\n	then\r\n		System.out.println(\"rule EVENT is triggered.\");\r\n		try {\r\n			// \r\n			// Check the requestID in the event to make sure it is not null before we create the EventManager. \r\n			// The EventManager will do extra syntax checking as well check if the closed loop is disabled/\r\n			//\r\n			if ($event.requestID == null) {\r\n				VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n				notification.notification = ControlLoopNotificationType.REJECTED;\r\n				notification.from = \"policy\";\r\n				notification.message = \"Missing requestID from DCAE event\";\r\n				notification.policyName = drools.getRule().getName();\r\n				notification.policyScope = \"com\";\r\n				notification.policyVersion = \"1\";\r\n				//\r\n				// Let interested parties know\r\n				//\r\n				try {\r\n					System.out.println(Serialization.gsonPretty.toJson(notification));\r\n					PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n				} catch (Exception e) {\r\n					e.printStackTrace();\r\n					System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				}\r\n				//\r\n				// Retract it from memory\r\n				//\r\n				retract($event);\r\n				System.out.println(\"Event with requestID=null has been retracted.\");\r\n			} else {\r\n				//\r\n				// Create an EventManager\r\n				//\r\n				EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);\r\n				//\r\n				// Determine if EventManager can actively process the event (i.e. syntax)\r\n				//\r\n				VirtualControlLoopNotification notification = manager.activate($event);\r\n				notification.from = \"policy\"; \r\n				notification.policyName = drools.getRule().getName();\r\n				notification.policyScope = \"com\";\r\n				notification.policyVersion = \"1\";\r\n				//\r\n				// Are we actively pursuing this event?\r\n				//\r\n				if (notification.notification == ControlLoopNotificationType.ACTIVE) {\r\n					//\r\n					// Insert Event Manager into memory, this will now kick off processing.\r\n					//\r\n					insert(manager);\r\n					//\r\n					// Let interested parties know\r\n					//\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						e.printStackTrace();\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n					}		\r\n				} else {\r\n					//\r\n					// Let interested parties know\r\n					//\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						e.printStackTrace();\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n					}\r\n					//\r\n					// Retract it from memory\r\n					//\r\n					retract($event);\r\n				}\r\n				//\r\n				// Now that the manager is inserted into Drools working memory, we\'ll wait for\r\n				// another rule to fire in order to continue processing. This way we can also\r\n				// then screen for additional ONSET and ABATED events for this same RequestIDs \r\n				// and for different RequestIDs but with the same closedLoopControlName and target.\r\n				//\r\n			}\r\n		//\r\n		} catch (Exception e) {\r\n			e.printStackTrace();\r\n			VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n			notification.notification = ControlLoopNotificationType.REJECTED;\r\n			notification.message = \"Exception occurred \" + e.getMessage();\r\n			notification.policyName = drools.getRule().getName();\r\n			notification.policyScope = \"com\";\r\n			notification.policyVersion = \"1\";\r\n			//\r\n			//\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e1) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e1.printStackTrace();\r\n			}\r\n			//\r\n			// Retract the event\r\n			//\r\n			retract($event);\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager\r\n* is created. We can start the operations for this closed loop.\r\n*\r\n*/\r\nrule \"BRMSParamvLBDemoPolicy.EVENT.MANAGER\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER is triggered.\");\r\n		//\r\n		// Check which event this is.\r\n		//\r\n		EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);\r\n		//\r\n		// We only want the initial ONSET event in memory,\r\n		// all the other events need to be retracted to support\r\n		// cleanup and avoid the other rules being fired for this event.\r\n		//\r\n		if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {\r\n			System.out.println(\"Retracting \"+eventStatus+\" Event.\");\r\n			retract($event);\r\n			return;\r\n		}\r\n		//\r\n		// Now the event in memory is first onset event\r\n		//\r\n		try {\r\n			//\r\n			// Pull the known AAI field from the Event\r\n			//\r\n			// generic-vnf is needed for vFirewall case\r\n			// vserver-name is needed for vLoadBalancer case\r\n			//\r\n			String genericVNF = $event.AAI.get(\"generic-vnf.vnf-id\");\r\n			String vserver = $event.AAI.get(\"vserver.vserver-name\");\r\n			//\r\n			// Check if we are implementing a simple pattern match.\r\n			//\r\n			if ($params.getAaiPatternMatch() == 1) {\r\n				//\r\n				// Yes\r\n				//\r\n				//Basic naming characteristics:\r\n				//VF Name (9 char)+VM name (13 char total)+VFC (19 char total)\r\n				//Example: \r\n				//VF Name (9 characters):    cscf0001v\r\n				//VM Name(13 characters): cscf0001vm001\r\n				//VFC name(19 characters): cscf0001vm001cfg001\r\n				//\r\n				// zdfw1fwl01fwl02 or zdfw1fwl01fwl01  \r\n				// replaced with\r\n				// zdfw1fwl01pgn02 or zdfw1fwl01pgn01\r\n				//\r\n				int index = genericVNF.lastIndexOf(\"fwl\");\r\n				if (index == -1) {\r\n					System.err.println(\"The generic-vnf.vnf-id from DCAE Event is not valid.\");\r\n				} else {\r\n					genericVNF = genericVNF.substring(0, index) + \"pgn\" + genericVNF.substring(index+\"fwl\".length());\r\n				}\r\n				//\r\n				// Construct an APPC request\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"ModifyConfig\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// insert operationWrapper into memory\r\n				//\r\n				insert(operationWrapper);\r\n				//\r\n				Request request = new Request();\r\n				request.CommonHeader = new CommonHeader();\r\n				request.CommonHeader.RequestID = $event.requestID;\r\n				request.Action = operation.operation;\r\n				request.Payload = new HashMap<String, Object>();\r\n				//\r\n				// Fill in the payload\r\n				//\r\n				request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\r\n				//\r\n				PGRequest pgRequest = new PGRequest();\r\n				pgRequest.pgStreams = new PGStreams();\r\n				\r\n				PGStream pgStream;\r\n				for(int i = 0; i < 5; i++){\r\n					pgStream = new PGStream();\r\n					pgStream.streamId = \"fw_udp\"+(i+1);\r\n					pgStream.isEnabled = \"true\";\r\n					pgRequest.pgStreams.pgStream.add(pgStream);\r\n				}\r\n				request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\r\n				\r\n				if (request != null) {\r\n					//\r\n					// Insert request into memory\r\n					//\r\n					insert(request);\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					// message and history ??\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"com\";\r\n					notification.policyVersion = \"1\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Now send the operation request\r\n					//\r\n					if (request instanceof Request) {\r\n						try {\r\n							System.out.println(\"APPC request sent:\");\r\n							System.out.println(Serialization.gsonPretty.toJson(request));\r\n							PolicyEngine.manager.deliver($params.getAppcTopic(), request);\r\n						} catch (Exception e) {\r\n							e.printStackTrace();\r\n							System.out.println(\"Can\'t deliver request: \" + request);\r\n						}\r\n					}\r\n				} else {\r\n					//\r\n					// what happens if it is null\r\n					//\r\n				}\r\n				//\r\n			} else {\r\n				//\r\n				// create AAI named-query request with UUID started with \"F199\"\r\n				//\r\n				AAINQF199Request aainqf199request = new AAINQF199Request();\r\n				AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();\r\n				AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();\r\n				AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();\r\n				//\r\n				// queryParameters\r\n				//\r\n				aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID()); \r\n				aainqf199queryparam.namedQuery = aainqf199namedquery;\r\n				aainqf199request.queryParameters = aainqf199queryparam;\r\n				//\r\n				// instanceFilters\r\n				//\r\n				Map aainqf199instancefiltermap = new HashMap();\r\n				Map aainqf199instancefiltermapitem = new HashMap();\r\n				aainqf199instancefiltermapitem.put(\"vserver-name\", vserver); \r\n				aainqf199instancefiltermap.put(\"vserver\", aainqf199instancefiltermapitem);\r\n				aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);\r\n				aainqf199request.instanceFilters = aainqf199instancefilter;\r\n				//\r\n				// print aainqf199request for debug\r\n				//\r\n				System.out.println(\"AAI Request sent:\");\r\n				System.out.println(Serialization.gsonPretty.toJson(aainqf199request));\r\n				//\r\n				// Create AAINQF199RequestWrapper\r\n				//\r\n				AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);\r\n				//\r\n				// insert aainqf199request into memory\r\n				//\r\n				insert(aainqf199RequestWrapper);\r\n			}\r\n			//\r\n		} catch (Exception e) {\r\n		 e.printStackTrace();\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager\r\n* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.\r\n*\r\n*/\r\nrule \"BRMSParamvLBDemoPolicy.EVENT.MANAGER.AAINQF199REQUEST\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER.AAINQF199REQUEST is triggered.\");\r\n		//\r\n		// send the request\r\n		//\r\n		AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),\r\n													   $aainqf199RequestWrapper.aainqf199request, $event.requestID);\r\n		//\r\n		// Check AAI response\r\n		//\r\n		if (aainqf199response == null) {\r\n			System.err.println(\"Failed to get AAI response\");\r\n			//\r\n			// Fail and retract everything\r\n			//\r\n			retract($event);\r\n			retract($manager);\r\n			retract($aainqf199RequestWrapper);\r\n		} else {\r\n			//\r\n			// Create AAINQF199ResponseWrapper\r\n			//\r\n			AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);\r\n			//\r\n			// insert aainqf199ResponseWrapper to memeory\r\n			//\r\n			insert(aainqf199ResponseWrapper);\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.\r\n*\r\n*/\r\nrule \"BRMSParamvLBDemoPolicy.EVENT.MANAGER.AAINQF199RESPONSE\"\r\n	when \r\n		$params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\r\n		$aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.\");\r\n		//\r\n		// Extract related fields out of AAINQF199RESPONSE\r\n		//\r\n		String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName, \r\n		       vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,\r\n		       serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,\r\n		       vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName, \r\n		       vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;\r\n		try {\r\n			//\r\n			// vnfItem\r\n			//\r\n			vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;\r\n			vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;\r\n			vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf(\"/\")+1);\r\n			vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;\r\n			vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;\r\n			vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\r\n			vnfItemModelVersion = 		$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;\r\n			vnfItemModelNameVersionId = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// serviceItem\r\n			//\r\n			serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;\r\n			serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;\r\n			serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\r\n			serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;\r\n			serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;\r\n			serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// This comes from the base module\r\n			//\r\n			vfModuleItemVfModuleName = 			$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).vfModule.vfModuleName;\r\n			vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace(\"Vfmodule\", \"vDNS\");\r\n			//\r\n			// vfModuleItem - NOT the base module\r\n			//\r\n			vfModuleItemPersonaModelId = 		$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).vfModule.personaModelId;\r\n			vfModuleItemPersonaModelVersion = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).vfModule.personaModelVersion;\r\n			vfModuleItemModelName = 				$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).extraProperties.extraProperty.get(0).propertyValue;\r\n			vfModuleItemModelNameVersionId = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// tenantItem\r\n			//\r\n			tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;\r\n			//\r\n			// cloudRegionItem\r\n			//\r\n			cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;\r\n			//\r\n		} catch (Exception e) {\r\n			e.printStackTrace();\r\n			VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n			notification.notification = ControlLoopNotificationType.REJECTED;\r\n			notification.message = \"Exception occurred \" + e.getMessage();\r\n			notification.policyName = drools.getRule().getName();\r\n			notification.policyScope = \"com\";\r\n			notification.policyVersion = \"1\";\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e1) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e1.printStackTrace();\r\n			}\r\n			//\r\n			notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n			notification.message = \"Invalid named-query response from AAI\";\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n                PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e1) {\r\n                System.out.println(\"Can\'t deliver notification: \" + notification);\r\n                e1.printStackTrace();\r\n            }\r\n			//\r\n			// Retract everything\r\n			//\r\n			retract($aainqf199RequestWrapper);\r\n			retract($aainqf199ResponseWrapper);\r\n			retract($manager);\r\n			retract($event);\r\n			return;\r\n		}	\r\n		//\r\n		// Extracted fields should not be null\r\n		//\r\n		if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||\r\n		    (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||\r\n		    (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||\r\n		    (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||\r\n		    (serviceItemModelType == null) || (serviceItemModelVersion == null) ||\r\n		    (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||\r\n		    (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||\r\n		    (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||\r\n		    (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {\r\n			//\r\n			System.err.println(\"some fields are missing from AAI response.\");\r\n			//\r\n			// Fail and retract everything\r\n			//\r\n			retract($aainqf199RequestWrapper);\r\n			retract($aainqf199ResponseWrapper);\r\n			retract($manager);\r\n			retract($event);\r\n			return;\r\n		}\r\n		//\r\n		// We don\'t need them any more\r\n		//\r\n		retract($aainqf199ResponseWrapper);\r\n		retract($aainqf199RequestWrapper);  \r\n		//\r\n		// check the actor of this closed loop\r\n		//\r\n		switch ($params.getActor()) {\r\n			case \"APPC\":\r\n			{\r\n				//\r\n				// Construct an APPC request\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"ModifyConfig\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// insert operationWrapper into memory\r\n				//\r\n				insert(operationWrapper);\r\n				//\r\n				Request request = new Request();\r\n				request.CommonHeader = new CommonHeader();\r\n				request.CommonHeader.RequestID = $event.requestID;\r\n				request.Action = operation.operation;\r\n				request.Payload = new HashMap<String, Object>();\r\n				//\r\n				// Fill in the payload\r\n				// Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case\r\n				//\r\n				String genericVNF = \"zdfw1fwl01pgn02\";\r\n				request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\r\n				//\r\n				PGRequest pgRequest = new PGRequest();\r\n				pgRequest.pgStreams = new PGStreams();\r\n				\r\n				PGStream pgStream;\r\n				for(int i = 0; i < 5; i++){\r\n					pgStream = new PGStream();\r\n					pgStream.streamId = \"fw_udp\"+(i+1);\r\n					pgStream.isEnabled = \"true\";\r\n					pgRequest.pgStreams.pgStream.add(pgStream);\r\n				}\r\n				request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\r\n				\r\n				if (request != null) {\r\n					//\r\n					// Insert request into memory\r\n					//\r\n					insert(request);\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					// message and history ??\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"com\";\r\n					notification.policyVersion = \"1\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Now send the operation request\r\n					//\r\n					if (request instanceof Request) {\r\n						try {\r\n							System.out.println(\"APPC request sent:\");\r\n							System.out.println(Serialization.gsonPretty.toJson(request));\r\n							PolicyEngine.manager.deliver($params.getAppcTopic(), request);\r\n						} catch (Exception e) {\r\n							e.printStackTrace();\r\n							System.out.println(\"Can\'t deliver request: \" + request);\r\n						}\r\n					}\r\n				} else {\r\n					//\r\n					// what happens if it is null\r\n					//\r\n				}\r\n			}\r\n			break;\r\n			case \"MSO\":\r\n			{\r\n				//\r\n				// Construct an operation\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"createModuleInstance\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// Construct an MSO request\r\n				//\r\n				MSORequest request = new MSORequest();\r\n				request.requestDetails = new MSORequestDetails();\r\n				request.requestDetails.modelInfo = new MSOModelInfo();\r\n				request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();\r\n				request.requestDetails.requestInfo = new MSORequestInfo();\r\n				request.requestDetails.requestParameters = new MSORequestParameters();\r\n				request.requestDetails.requestParameters.userParams = null;\r\n				//\r\n				// cloudConfiguration\r\n				//\r\n				request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;\r\n				request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;\r\n				//\r\n				// modelInfo\r\n				//\r\n				request.requestDetails.modelInfo.modelType = \"vfModule\";\r\n				request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;\r\n				request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;\r\n				request.requestDetails.modelInfo.modelName = vfModuleItemModelName;\r\n				request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;\r\n				//\r\n				// requestInfo\r\n				//\r\n				request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;\r\n				request.requestDetails.requestInfo.source = \"POLICY\";\r\n				request.requestDetails.requestInfo.suppressRollback = false;\r\n				//\r\n				// relatedInstanceList\r\n				//\r\n				MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();\r\n				MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();\r\n				relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();\r\n				relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();\r\n				//\r\n				relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelType = \"service\";\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;\r\n				//\r\n				relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelType = \"vnf\";\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;\r\n				//	\r\n				request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);\r\n				request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);\r\n				//\r\n				// print MSO request for debug\r\n				//\r\n				System.out.println(\"MSO request sent:\");\r\n				System.out.println(Serialization.gsonPretty.toJson(request));\r\n				//\r\n				//\r\n				//\r\n				if (request != null) {\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"com\";\r\n					notification.policyVersion = \"1\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL\r\n					//\r\n					String MSOUrl = $params.getMsoURL() + \"/serviceInstances/v2/\" + serviceItemServiceInstanceId + \"/vnfs/\" + vnfItemVnfId + \"/vfModules\";\r\n					//\r\n					// Call MSO\r\n					//\r\n					MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);\r\n					//\r\n					if (response != null) {\r\n						//\r\n						// Assign requestId\r\n						//\r\n						request.requestId = $event.requestID.toString();						\r\n						response.request.requestId = $event.requestID.toString();\r\n						//\r\n						// Insert facts\r\n						//\r\n						insert(operationWrapper);\r\n						insert(request);\r\n						insert(response);\r\n					} else {\r\n						//\r\n						// MSO request not even accepted\r\n						//\r\n						notification.message = operationWrapper.operation.toMessage();\r\n						operationWrapper.operation.message = operationWrapper.operation.toMessage();\r\n						operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n						$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n						notification.history.add(operationWrapper.operation);\r\n						notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n						//\r\n						// Let interested parties know\r\n						//\r\n						try {\r\n							System.out.println(Serialization.gsonPretty.toJson(notification));\r\n							PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n						} catch (Exception e) {\r\n							System.out.println(\"Can\'t deliver notification: \" + notification);\r\n							e.printStackTrace();\r\n						}\r\n	                    notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n                        try {\r\n                        	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n                        	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n                        } catch (Exception e) {\r\n                        	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n                        	e.printStackTrace();\r\n                        }\r\n						//\r\n						// Retract everything\r\n						//\r\n						retract($event);\r\n						retract($manager);\r\n					}\r\n				} else {\r\n					System.err.println(\"constructed MSO request is invalid.\");\r\n				}\r\n			}\r\n			break; \r\n		} \r\nend\r\n		\r\n/*\r\n*\r\n* This rule responds to APPC Response Events\r\n*\r\n*/\r\nrule \"BRMSParamvLBDemoPolicy.APPC.RESPONSE\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\r\n		$request : Request( getCommonHeader().RequestID == $event.requestID )\r\n		$response : Response( getCommonHeader().RequestID == $event.requestID )	\r\n	then\r\n		System.out.println(\"rule APPC.RESPONSE is triggered.\");\r\n		if ($response.Status == null) {\r\n			$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n			$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n		} \r\n		//\r\n		// Get the Response Code\r\n		//\r\n		ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);\r\n		if (code == null) {\r\n			$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n			$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n		}\r\n		//\r\n		// Construct notification\r\n		//\r\n		VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n		notification.from = \"policy\";\r\n		notification.policyName = drools.getRule().getName();\r\n		notification.policyScope = \"com\";\r\n		notification.policyVersion = \"1\";\r\n		notification.message = $operationWrapper.operation.toMessage();\r\n		$operationWrapper.operation.message = $operationWrapper.operation.toMessage();\r\n		//\r\n		// Ok, let\'s figure out what APP-C\'s response is\r\n		//\r\n		switch (code) {\r\n			case ACCEPT:\r\n				$operationWrapper.operation.outcome = \"PROCESSING\";\r\n				break;\r\n			case ERROR:\r\n			case REJECT:\r\n				$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n				$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n				break;\r\n			case SUCCESS:\r\n				$operationWrapper.operation.outcome = \"SUCCESS\";\r\n				$manager.setControlLoopResult(\"SUCCESS\");\r\n				break;\r\n			case FAILURE:\r\n				$operationWrapper.operation.outcome = \"FAILURE\";\r\n				$manager.setControlLoopResult(\"FAILURE\");\r\n				break;\r\n		}\r\n		if ($operationWrapper.operation.outcome.equals(\"SUCCESS\")) {\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n            notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n\r\n			//\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		} else if ($operationWrapper.operation.outcome.equals(\"PROCESSING\")) {\r\n			retract($response);\r\n		} else {\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n            notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n			//\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		}\r\n		\r\nend		\r\n\r\n/*\r\n*\r\n* This rule is used to clean up APPC response\r\n*\r\n*/		\r\nrule \"BRMSParamvLBDemoPolicy.APPC.RESPONSE.CLEANUP\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n        $response : Response($id : getCommonHeader().RequestID )\r\n		not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) ) \r\n	then\r\n		System.out.println(\"rule APPC.RESPONSE.CLEANUP is triggered.\");\r\n		retract($response);\r\nend\r\n\r\n/*\r\n*\r\n* This rule responds to MSO Response Events\r\n*\r\n*/\r\nrule \"BRMSParamvLBDemoPolicy.MSO.RESPONSE\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\r\n		$request : MSORequest( requestId == $event.requestID.toString() )\r\n		$response : MSOResponse( request.requestId == $event.requestID.toString() )	\r\n	then\r\n		System.out.println(\"rule MSO.RESPONSE is triggered.\");\r\n		//\r\n		// Construct notification\r\n		//\r\n		VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n		notification.from = \"policy\";\r\n		notification.policyName = drools.getRule().getName();\r\n		notification.policyScope = \"com\";\r\n		notification.policyVersion = \"1\";\r\n		notification.message = $operationWrapper.operation.toMessage();\r\n		$operationWrapper.operation.message = $operationWrapper.operation.toMessage();\r\n		//\r\n		// The operation can either be succeeded or failed\r\n		// \r\n		if($response.request.requestStatus.requestState.equals(\"Completed\")) {\r\n			$operationWrapper.operation.outcome = \"SUCCESS\";\r\n			$manager.setControlLoopResult(\"SUCCESS\");\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n			notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n            //\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		} else {\r\n			$operationWrapper.operation.outcome = \"FAILURE\";\r\n			$manager.setControlLoopResult(\"FAILURE\");\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n			notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n            //\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		}\r\n		\r\nend	\nrule \"Params\" \n	salience 1000 \n	when\n	then\n		Params params = new Params();\n		params.setAaiPatternMatch(0);\n		params.setAppcTopic(\"APPC-CL\");\n		params.setAaiURL(\"https://aai.api.simpledemo.openecomp.org:8443\");\n		params.setMsoPassword(\"password1$\");\n		params.setClosedLoopControlName(\"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\");\n		params.setAaiUsername(\"POLICY\");\n		params.setMsoURL(\"http://vm1.mso.simpledemo.openecomp.org:8080/ecomp/mso/infra\");\n		params.setActor(\"MSO\");\n		params.setMsoUsername(\"InfraPortalClient\");\n		params.setAaiNamedQueryUUID(\"f199cb88-5e69-4b1f-93e0-6f257877d066\");\n		params.setAaiPassword(\"POLICY\");\n		params.setNotificationTopic(\"POLICY-CL-MGT\");\n		insert(params);\nend\r\n','OTHER','com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt','doACPolicyPut','2017-02-09 17:16:17',0,'','doACPolicyPut','2017-02-09 17:16:17',1),(3156,'{\"service\":\"TcaMetrics\",\"location\":\"SampleServiceLocation\",\"uuid\":\"/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall\",\"policyName\":\"vFirewall\",\"description\":\"Micro Service vFirewall Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:\",\"configName\":\"SampleConfigName\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"1.0.0.5\",\"priority\":\"1\",\"policyScope\":\"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\",\"content\":{\"thresholds\":[{\"severity\":\"MAJOR\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn\",\"thresholdValue\":\"300\",\"closedLoopControlName\":\"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\":\"1.0.2\",\"direction\":\"LESS_OR_EQUAL\"},{\"severity\":\"CRITICAL\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn\",\"thresholdValue\":\"700\",\"closedLoopControlName\":\"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\":\"1.0.2\",\"direction\":\"GREATER_OR_EQUAL\"}],\"functionalRole\":\"vFirewall\",\"name\":\"0\"}}\r\n','JSON','com.Config_MS_vFirewall.1.json','doACPolicyPut','2017-02-09 17:19:38',0,'','doACPolicyPut','2017-02-09 17:19:38',1),(3158,'{\"service\":\"TcaMetrics\",\"location\":\"SampleServiceLocation\",\"uuid\":\"/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer\",\"policyName\":\"vLoadBalancer\",\"description\":\"Micro Service vLoadBalancer Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:\",\"configName\":\"SampleConfigName\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"1.0.0.5\",\"priority\":\"1\",\"policyScope\":\"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\",\"content\":{\"thresholds\":[{\"severity\":\"MAJOR\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn\",\"thresholdValue\":\"200\",\"closedLoopControlName\":\"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\":\"1.0.2\",\"direction\":\"GREATER_OR_EQUAL\"}],\"functionalRole\":\"vLoadBalancer\",\"name\":\"0\"}}\r\n','JSON','com.Config_MS_vLoadBalancer.1.json','doACPolicyPut','2017-02-09 17:21:15',0,'','doACPolicyPut','2017-02-09 17:21:15',1);

INSERT INTO `policyversion` VALUES (1,'com/Config_BRMS_Param_BRMSParamvFWDemoPolicy',1,1,'2017-02-09 17:13:43','demo','2017-02-09 17:13:43','demo'),(2,'com/Config_BRMS_Param_BRMSParamvLBDemoPolicy',1,1,'2017-02-09 17:16:19','demo','2017-02-09 17:16:19','demo'),(3,'com/Config_MS_vFirewall',1,1,'2017-02-09 17:19:40','demo','2017-02-09 17:19:40','demo'),(4,'com/Config_MS_vLoadBalancer',1,1,'2017-02-09 17:21:17','demo','2017-02-09 17:21:17','demo');

INSERT INTO `brmsparamtemplate` VALUES (5,'ControlLoopDemo__closedLoopControlName','ControlLoopDemo__closedLoopControlName','\r\n\r\n/*-\r\n * ============LICENSE_START=======================================================\r\n * archetype-closed-loop-demo-rules\r\n * ================================================================================\r\n * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r\n * ================================================================================\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * \r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n * ============LICENSE_END=========================================================\r\n */\r\n\r\npackage org.openecomp.policy.controlloop;\r\n\r\nimport java.util.LinkedList;\r\nimport java.util.Map;\r\nimport java.util.HashMap;\r\nimport java.util.UUID;\r\n\r\nimport org.openecomp.policy.controlloop.VirtualControlLoopEvent;\r\nimport org.openecomp.policy.controlloop.ControlLoopEventStatus;\r\nimport org.openecomp.policy.controlloop.VirtualControlLoopNotification;\r\nimport org.openecomp.policy.controlloop.ControlLoopNotificationType;\r\nimport org.openecomp.policy.controlloop.ControlLoopOperation;\r\nimport org.openecomp.policy.controlloop.ControlLoopOperationWrapper;\r\nimport org.openecomp.policy.template.demo.ControlLoopException;\r\n\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199CloudRegion;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperties;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperty;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199GenericVNF;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InstanceFilters;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Manager;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199NamedQuery;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199QueryParameters;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Request;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199RequestWrapper;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Response;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ResponseWrapper;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199ServiceInstance;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199Tenant;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199VfModule;\r\nimport org.openecomp.policy.aai.AAINQF199.AAINQF199VServer;\r\nimport org.openecomp.policy.aai.util.Serialization;\r\n\r\nimport org.openecomp.policy.appc.CommonHeader;\r\nimport org.openecomp.policy.appc.Request;\r\nimport org.openecomp.policy.appc.Response;\r\nimport org.openecomp.policy.appc.ResponseCode;\r\nimport org.openecomp.policy.appc.ResponseStatus;\r\nimport org.openecomp.policy.appc.ResponseValue;\r\n\r\nimport org.openecomp.policy.template.demo.EventManager;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGRequest;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGStream;\r\nimport org.openecomp.policy.vnf.trafficgenerator.PGStreams;\r\n\r\nimport org.openecomp.policy.mso.MSOManager;\r\nimport org.openecomp.policy.mso.MSORequest;\r\nimport org.openecomp.policy.mso.MSORequestStatus;\r\nimport org.openecomp.policy.mso.MSORequestDetails;\r\nimport org.openecomp.policy.mso.MSOModelInfo;\r\nimport org.openecomp.policy.mso.MSOCloudConfiguration;\r\nimport org.openecomp.policy.mso.MSORequestInfo;\r\nimport org.openecomp.policy.mso.MSORequestParameters;\r\nimport org.openecomp.policy.mso.MSORelatedInstanceListElement;\r\nimport org.openecomp.policy.mso.MSORelatedInstance;\r\nimport org.openecomp.policy.mso.MSOResponse;\r\n\r\nimport org.openecomp.policy.drools.system.PolicyEngine;\r\n\r\n//\r\n// These parameters are required to build the runtime policy\r\n//\r\ndeclare Params\r\n    closedLoopControlName : String\r\n    actor : String\r\n    aaiURL : String\r\n    aaiUsername : String\r\n    aaiPassword : String\r\n    msoURL : String\r\n    msoUsername : String\r\n    msoPassword : String\r\n    aaiNamedQueryUUID : String\r\n    aaiPatternMatch : int \r\n    notificationTopic : String\r\n    appcTopic : String\r\nend\r\n\r\n/*\r\n*\r\n* Called once and only once to insert the parameters into working memory for this Closed Loop policy.\r\n* (Comment SETUP rule out for the first ECOMP opensource release since policy BRMS_GW already puts a Params fact in there)\r\n*\r\n*\r\n*rule \"${policyName}.SETUP\"\r\n*	when\r\n*	then\r\n*		System.out.println(\"rule SETUP is triggered.\");\r\n*		Params params = new Params();\r\n*		params.setClosedLoopControlName(\"${closedLoopControlName}\");\r\n*		params.setActor(\"${actor}\");\r\n*		params.setAaiURL(\"${aaiURL}\");\r\n*		params.setAaiUsername(\"${aaiUsername}\");\r\n*		params.setAaiPassword(\"${aaiPassword}\");\r\n*		params.setMsoURL(\"${msoURL}\");\r\n*		params.setMsoUsername(\"${msoUsername}\");\r\n*		params.setMsoPassword(\"${msoPassword}\");\r\n*		params.setAaiNamedQueryUUID(\"${aaiNamedQueryUUID}\");\r\n*		params.setAaiPatternMatch(${aaiPatternMatch});\r\n*		params.setNotificationTopic(\"${notificationTopic}\");\r\n*		params.setAppcTopic(\"${appcTopic}\");\r\n*		//\r\n*		// This stays in memory as long as the rule is alive and running\r\n*		//\r\n*		insert(params);\r\n*end\r\n*/\r\n/*\r\n*\r\n* This rule responds to DCAE Events\r\n*\r\n*/\r\nrule \"${policyName}.EVENT\"\r\n	when\r\n        $params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\r\n        $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n        not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))\r\n	then\r\n		System.out.println(\"rule EVENT is triggered.\");\r\n		try {\r\n			// \r\n			// Check the requestID in the event to make sure it is not null before we create the EventManager. \r\n			// The EventManager will do extra syntax checking as well check if the closed loop is disabled/\r\n			//\r\n			if ($event.requestID == null) {\r\n				VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n				notification.notification = ControlLoopNotificationType.REJECTED;\r\n				notification.from = \"policy\";\r\n				notification.message = \"Missing requestID from DCAE event\";\r\n				notification.policyName = drools.getRule().getName();\r\n				notification.policyScope = \"${policyScope}\";\r\n				notification.policyVersion = \"${policyVersion}\";\r\n				//\r\n				// Let interested parties know\r\n				//\r\n				try {\r\n					System.out.println(Serialization.gsonPretty.toJson(notification));\r\n					PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n				} catch (Exception e) {\r\n					e.printStackTrace();\r\n					System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				}\r\n				//\r\n				// Retract it from memory\r\n				//\r\n				retract($event);\r\n				System.out.println(\"Event with requestID=null has been retracted.\");\r\n			} else {\r\n				//\r\n				// Create an EventManager\r\n				//\r\n				EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);\r\n				//\r\n				// Determine if EventManager can actively process the event (i.e. syntax)\r\n				//\r\n				VirtualControlLoopNotification notification = manager.activate($event);\r\n				notification.from = \"policy\"; \r\n				notification.policyName = drools.getRule().getName();\r\n				notification.policyScope = \"${policyScope}\";\r\n				notification.policyVersion = \"${policyVersion}\";\r\n				//\r\n				// Are we actively pursuing this event?\r\n				//\r\n				if (notification.notification == ControlLoopNotificationType.ACTIVE) {\r\n					//\r\n					// Insert Event Manager into memory, this will now kick off processing.\r\n					//\r\n					insert(manager);\r\n					//\r\n					// Let interested parties know\r\n					//\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						e.printStackTrace();\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n					}		\r\n				} else {\r\n					//\r\n					// Let interested parties know\r\n					//\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						e.printStackTrace();\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n					}\r\n					//\r\n					// Retract it from memory\r\n					//\r\n					retract($event);\r\n				}\r\n				//\r\n				// Now that the manager is inserted into Drools working memory, we\'ll wait for\r\n				// another rule to fire in order to continue processing. This way we can also\r\n				// then screen for additional ONSET and ABATED events for this same RequestIDs \r\n				// and for different RequestIDs but with the same closedLoopControlName and target.\r\n				//\r\n			}\r\n		//\r\n		} catch (Exception e) {\r\n			e.printStackTrace();\r\n			VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n			notification.notification = ControlLoopNotificationType.REJECTED;\r\n			notification.message = \"Exception occurred \" + e.getMessage();\r\n			notification.policyName = drools.getRule().getName();\r\n			notification.policyScope = \"${policyScope}\";\r\n			notification.policyVersion = \"${policyVersion}\";\r\n			//\r\n			//\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e1) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e1.printStackTrace();\r\n			}\r\n			//\r\n			// Retract the event\r\n			//\r\n			retract($event);\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager\r\n* is created. We can start the operations for this closed loop.\r\n*\r\n*/\r\nrule \"${policyName}.EVENT.MANAGER\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER is triggered.\");\r\n		//\r\n		// Check which event this is.\r\n		//\r\n		EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);\r\n		//\r\n		// We only want the initial ONSET event in memory,\r\n		// all the other events need to be retracted to support\r\n		// cleanup and avoid the other rules being fired for this event.\r\n		//\r\n		if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {\r\n			System.out.println(\"Retracting \"+eventStatus+\" Event.\");\r\n			retract($event);\r\n			return;\r\n		}\r\n		//\r\n		// Now the event in memory is first onset event\r\n		//\r\n		try {\r\n			//\r\n			// Pull the known AAI field from the Event\r\n			//\r\n			// generic-vnf is needed for vFirewall case\r\n			// vserver-name is needed for vLoadBalancer case\r\n			//\r\n			String genericVNF = $event.AAI.get(\"generic-vnf.vnf-id\");\r\n			String vserver = $event.AAI.get(\"vserver.vserver-name\");\r\n			//\r\n			// Check if we are implementing a simple pattern match.\r\n			//\r\n			if ($params.getAaiPatternMatch() == 1) {\r\n				//\r\n				// Yes\r\n				//\r\n				//Basic naming characteristics:\r\n				//VF Name (9 char)+VM name (13 char total)+VFC (19 char total)\r\n				//Example: \r\n				//VF Name (9 characters):    cscf0001v\r\n				//VM Name(13 characters): cscf0001vm001\r\n				//VFC name(19 characters): cscf0001vm001cfg001\r\n				//\r\n				// zdfw1fwl01fwl02 or zdfw1fwl01fwl01  \r\n				// replaced with\r\n				// zdfw1fwl01pgn02 or zdfw1fwl01pgn01\r\n				//\r\n				int index = genericVNF.lastIndexOf(\"fwl\");\r\n				if (index == -1) {\r\n					System.err.println(\"The generic-vnf.vnf-id from DCAE Event is not valid.\");\r\n				} else {\r\n					genericVNF = genericVNF.substring(0, index) + \"pgn\" + genericVNF.substring(index+\"fwl\".length());\r\n				}\r\n				//\r\n				// Construct an APPC request\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"ModifyConfig\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// insert operationWrapper into memory\r\n				//\r\n				insert(operationWrapper);\r\n				//\r\n				Request request = new Request();\r\n				request.CommonHeader = new CommonHeader();\r\n				request.CommonHeader.RequestID = $event.requestID;\r\n				request.Action = operation.operation;\r\n				request.Payload = new HashMap<String, Object>();\r\n				//\r\n				// Fill in the payload\r\n				//\r\n				request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\r\n				//\r\n				PGRequest pgRequest = new PGRequest();\r\n				pgRequest.pgStreams = new PGStreams();\r\n				\r\n				PGStream pgStream;\r\n				for(int i = 0; i < 5; i++){\r\n					pgStream = new PGStream();\r\n					pgStream.streamId = \"fw_udp\"+(i+1);\r\n					pgStream.isEnabled = \"true\";\r\n					pgRequest.pgStreams.pgStream.add(pgStream);\r\n				}\r\n				request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\r\n				\r\n				if (request != null) {\r\n					//\r\n					// Insert request into memory\r\n					//\r\n					insert(request);\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					// message and history ??\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"${policyScope}\";\r\n					notification.policyVersion = \"${policyVersion}\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Now send the operation request\r\n					//\r\n					if (request instanceof Request) {\r\n						try {\r\n							System.out.println(\"APPC request sent:\");\r\n							System.out.println(Serialization.gsonPretty.toJson(request));\r\n							PolicyEngine.manager.deliver($params.getAppcTopic(), request);\r\n						} catch (Exception e) {\r\n							e.printStackTrace();\r\n							System.out.println(\"Can\'t deliver request: \" + request);\r\n						}\r\n					}\r\n				} else {\r\n					//\r\n					// what happens if it is null\r\n					//\r\n				}\r\n				//\r\n			} else {\r\n				//\r\n				// create AAI named-query request with UUID started with \"F199\"\r\n				//\r\n				AAINQF199Request aainqf199request = new AAINQF199Request();\r\n				AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();\r\n				AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();\r\n				AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();\r\n				//\r\n				// queryParameters\r\n				//\r\n				aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID()); \r\n				aainqf199queryparam.namedQuery = aainqf199namedquery;\r\n				aainqf199request.queryParameters = aainqf199queryparam;\r\n				//\r\n				// instanceFilters\r\n				//\r\n				Map aainqf199instancefiltermap = new HashMap();\r\n				Map aainqf199instancefiltermapitem = new HashMap();\r\n				aainqf199instancefiltermapitem.put(\"vserver-name\", vserver); \r\n				aainqf199instancefiltermap.put(\"vserver\", aainqf199instancefiltermapitem);\r\n				aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);\r\n				aainqf199request.instanceFilters = aainqf199instancefilter;\r\n				//\r\n				// print aainqf199request for debug\r\n				//\r\n				System.out.println(\"AAI Request sent:\");\r\n				System.out.println(Serialization.gsonPretty.toJson(aainqf199request));\r\n				//\r\n				// Create AAINQF199RequestWrapper\r\n				//\r\n				AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);\r\n				//\r\n				// insert aainqf199request into memory\r\n				//\r\n				insert(aainqf199RequestWrapper);\r\n			}\r\n			//\r\n		} catch (Exception e) {\r\n		 e.printStackTrace();\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager\r\n* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.\r\n*\r\n*/\r\nrule \"${policyName}.EVENT.MANAGER.AAINQF199REQUEST\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER.AAINQF199REQUEST is triggered.\");\r\n		//\r\n		// send the request\r\n		//\r\n		AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),\r\n													   $aainqf199RequestWrapper.aainqf199request, $event.requestID);\r\n		//\r\n		// Check AAI response\r\n		//\r\n		if (aainqf199response == null) {\r\n			System.err.println(\"Failed to get AAI response\");\r\n			//\r\n			// Fail and retract everything\r\n			//\r\n			retract($event);\r\n			retract($manager);\r\n			retract($aainqf199RequestWrapper);\r\n		} else {\r\n			//\r\n			// Create AAINQF199ResponseWrapper\r\n			//\r\n			AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);\r\n			//\r\n			// insert aainqf199ResponseWrapper to memeory\r\n			//\r\n			insert(aainqf199ResponseWrapper);\r\n		}\r\nend\r\n\r\n/*\r\n*\r\n* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.\r\n*\r\n*/\r\nrule \"${policyName}.EVENT.MANAGER.AAINQF199RESPONSE\"\r\n	when \r\n		$params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\r\n		$aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)\r\n	then\r\n		System.out.println(\"rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.\");\r\n		//\r\n		// Extract related fields out of AAINQF199RESPONSE\r\n		//\r\n		String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName, \r\n		       vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,\r\n		       serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,\r\n		       vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName, \r\n		       vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;\r\n		try {\r\n			//\r\n			// vnfItem\r\n			//\r\n			vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;\r\n			vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;\r\n			vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf(\"/\")+1);\r\n			vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;\r\n			vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;\r\n			vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\r\n			vnfItemModelVersion = 		$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;\r\n			vnfItemModelNameVersionId = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// serviceItem\r\n			//\r\n			serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;\r\n			serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;\r\n			serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\r\n			serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;\r\n			serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;\r\n			serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// This comes from the base module\r\n			//\r\n			vfModuleItemVfModuleName = 			$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).vfModule.vfModuleName;\r\n			vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace(\"Vfmodule\", \"vDNS\");\r\n			//\r\n			// vfModuleItem - NOT the base module\r\n			//\r\n			vfModuleItemPersonaModelId = 		$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).vfModule.personaModelId;\r\n			vfModuleItemPersonaModelVersion = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).vfModule.personaModelVersion;\r\n			vfModuleItemModelName = 				$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).extraProperties.extraProperty.get(0).propertyValue;\r\n			vfModuleItemModelNameVersionId = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(2).extraProperties.extraProperty.get(4).propertyValue;\r\n			//\r\n			// tenantItem\r\n			//\r\n			tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;\r\n			//\r\n			// cloudRegionItem\r\n			//\r\n			cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;\r\n			//\r\n		} catch (Exception e) {\r\n			e.printStackTrace();\r\n			VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n			notification.notification = ControlLoopNotificationType.REJECTED;\r\n			notification.message = \"Exception occurred \" + e.getMessage();\r\n			notification.policyName = drools.getRule().getName();\r\n			notification.policyScope = \"${policyScope}\";\r\n			notification.policyVersion = \"${policyVersion}\";\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e1) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e1.printStackTrace();\r\n			}\r\n			//\r\n			notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n			notification.message = \"Invalid named-query response from AAI\";\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n                PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e1) {\r\n                System.out.println(\"Can\'t deliver notification: \" + notification);\r\n                e1.printStackTrace();\r\n            }\r\n			//\r\n			// Retract everything\r\n			//\r\n			retract($aainqf199RequestWrapper);\r\n			retract($aainqf199ResponseWrapper);\r\n			retract($manager);\r\n			retract($event);\r\n			return;\r\n		}	\r\n		//\r\n		// Extracted fields should not be null\r\n		//\r\n		if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||\r\n		    (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||\r\n		    (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||\r\n		    (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||\r\n		    (serviceItemModelType == null) || (serviceItemModelVersion == null) ||\r\n		    (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||\r\n		    (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||\r\n		    (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||\r\n		    (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {\r\n			//\r\n			System.err.println(\"some fields are missing from AAI response.\");\r\n			//\r\n			// Fail and retract everything\r\n			//\r\n			retract($aainqf199RequestWrapper);\r\n			retract($aainqf199ResponseWrapper);\r\n			retract($manager);\r\n			retract($event);\r\n			return;\r\n		}\r\n		//\r\n		// We don\'t need them any more\r\n		//\r\n		retract($aainqf199ResponseWrapper);\r\n		retract($aainqf199RequestWrapper);  \r\n		//\r\n		// check the actor of this closed loop\r\n		//\r\n		switch ($params.getActor()) {\r\n			case \"APPC\":\r\n			{\r\n				//\r\n				// Construct an APPC request\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"ModifyConfig\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// insert operationWrapper into memory\r\n				//\r\n				insert(operationWrapper);\r\n				//\r\n				Request request = new Request();\r\n				request.CommonHeader = new CommonHeader();\r\n				request.CommonHeader.RequestID = $event.requestID;\r\n				request.Action = operation.operation;\r\n				request.Payload = new HashMap<String, Object>();\r\n				//\r\n				// Fill in the payload\r\n				// Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case\r\n				//\r\n				String genericVNF = \"zdfw1fwl01pgn02\";\r\n				request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\r\n				//\r\n				PGRequest pgRequest = new PGRequest();\r\n				pgRequest.pgStreams = new PGStreams();\r\n				\r\n				PGStream pgStream;\r\n				for(int i = 0; i < 5; i++){\r\n					pgStream = new PGStream();\r\n					pgStream.streamId = \"fw_udp\"+(i+1);\r\n					pgStream.isEnabled = \"true\";\r\n					pgRequest.pgStreams.pgStream.add(pgStream);\r\n				}\r\n				request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\r\n				\r\n				if (request != null) {\r\n					//\r\n					// Insert request into memory\r\n					//\r\n					insert(request);\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					// message and history ??\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"${policyScope}\";\r\n					notification.policyVersion = \"${policyVersion}\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Now send the operation request\r\n					//\r\n					if (request instanceof Request) {\r\n						try {\r\n							System.out.println(\"APPC request sent:\");\r\n							System.out.println(Serialization.gsonPretty.toJson(request));\r\n							PolicyEngine.manager.deliver($params.getAppcTopic(), request);\r\n						} catch (Exception e) {\r\n							e.printStackTrace();\r\n							System.out.println(\"Can\'t deliver request: \" + request);\r\n						}\r\n					}\r\n				} else {\r\n					//\r\n					// what happens if it is null\r\n					//\r\n				}\r\n			}\r\n			break;\r\n			case \"MSO\":\r\n			{\r\n				//\r\n				// Construct an operation\r\n				//\r\n				ControlLoopOperation operation = new ControlLoopOperation();\r\n				operation.actor = $params.getActor();\r\n				operation.operation = \"createModuleInstance\";\r\n				operation.target = $event.target;\r\n				//\r\n				// Create operationWrapper\r\n				//\r\n				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\r\n				//\r\n				// Construct an MSO request\r\n				//\r\n				MSORequest request = new MSORequest();\r\n				request.requestDetails = new MSORequestDetails();\r\n				request.requestDetails.modelInfo = new MSOModelInfo();\r\n				request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();\r\n				request.requestDetails.requestInfo = new MSORequestInfo();\r\n				request.requestDetails.requestParameters = new MSORequestParameters();\r\n				request.requestDetails.requestParameters.userParams = null;\r\n				//\r\n				// cloudConfiguration\r\n				//\r\n				request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;\r\n				request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;\r\n				//\r\n				// modelInfo\r\n				//\r\n				request.requestDetails.modelInfo.modelType = \"vfModule\";\r\n				request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;\r\n				request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;\r\n				request.requestDetails.modelInfo.modelName = vfModuleItemModelName;\r\n				request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;\r\n				//\r\n				// requestInfo\r\n				//\r\n				request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;\r\n				request.requestDetails.requestInfo.source = \"POLICY\";\r\n				request.requestDetails.requestInfo.suppressRollback = false;\r\n				//\r\n				// relatedInstanceList\r\n				//\r\n				MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();\r\n				MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();\r\n				relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();\r\n				relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();\r\n				//\r\n				relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelType = \"service\";\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;\r\n				relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;\r\n				//\r\n				relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelType = \"vnf\";\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;\r\n				relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;\r\n				//	\r\n				request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);\r\n				request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);\r\n				//\r\n				// print MSO request for debug\r\n				//\r\n				System.out.println(\"MSO request sent:\");\r\n				System.out.println(Serialization.gsonPretty.toJson(request));\r\n				//\r\n				//\r\n				//\r\n				if (request != null) {\r\n					//\r\n					// Tell interested parties we are performing this Operation\r\n					//\r\n					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n					notification.notification = ControlLoopNotificationType.OPERATION;\r\n					notification.from = \"policy\";\r\n					notification.policyName = drools.getRule().getName();\r\n					notification.policyScope = \"${policyScope}\";\r\n					notification.policyVersion = \"${policyVersion}\";\r\n					try {\r\n						System.out.println(Serialization.gsonPretty.toJson(notification));\r\n						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n					} catch (Exception e) {\r\n						System.out.println(\"Can\'t deliver notification: \" + notification);\r\n						e.printStackTrace();\r\n					}\r\n					//\r\n					// Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL\r\n					//\r\n					String MSOUrl = $params.getMsoURL() + \"/serviceInstances/v2/\" + serviceItemServiceInstanceId + \"/vnfs/\" + vnfItemVnfId + \"/vfModules\";\r\n					//\r\n					// Call MSO\r\n					//\r\n					MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);\r\n					//\r\n					if (response != null) {\r\n						//\r\n						// Assign requestId\r\n						//\r\n						request.requestId = $event.requestID.toString();						\r\n						response.request.requestId = $event.requestID.toString();\r\n						//\r\n						// Insert facts\r\n						//\r\n						insert(operationWrapper);\r\n						insert(request);\r\n						insert(response);\r\n					} else {\r\n						//\r\n						// MSO request not even accepted\r\n						//\r\n						notification.message = operationWrapper.operation.toMessage();\r\n						operationWrapper.operation.message = operationWrapper.operation.toMessage();\r\n						operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n						$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n						notification.history.add(operationWrapper.operation);\r\n						notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n						//\r\n						// Let interested parties know\r\n						//\r\n						try {\r\n							System.out.println(Serialization.gsonPretty.toJson(notification));\r\n							PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n						} catch (Exception e) {\r\n							System.out.println(\"Can\'t deliver notification: \" + notification);\r\n							e.printStackTrace();\r\n						}\r\n	                    notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n                        try {\r\n                        	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n                        	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n                        } catch (Exception e) {\r\n                        	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n                        	e.printStackTrace();\r\n                        }\r\n						//\r\n						// Retract everything\r\n						//\r\n						retract($event);\r\n						retract($manager);\r\n					}\r\n				} else {\r\n					System.err.println(\"constructed MSO request is invalid.\");\r\n				}\r\n			}\r\n			break; \r\n		} \r\nend\r\n		\r\n/*\r\n*\r\n* This rule responds to APPC Response Events\r\n*\r\n*/\r\nrule \"${policyName}.APPC.RESPONSE\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\r\n		$request : Request( getCommonHeader().RequestID == $event.requestID )\r\n		$response : Response( getCommonHeader().RequestID == $event.requestID )	\r\n	then\r\n		System.out.println(\"rule APPC.RESPONSE is triggered.\");\r\n		if ($response.Status == null) {\r\n			$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n			$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n		} \r\n		//\r\n		// Get the Response Code\r\n		//\r\n		ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);\r\n		if (code == null) {\r\n			$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n			$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n		}\r\n		//\r\n		// Construct notification\r\n		//\r\n		VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n		notification.from = \"policy\";\r\n		notification.policyName = drools.getRule().getName();\r\n		notification.policyScope = \"${policyScope}\";\r\n		notification.policyVersion = \"${policyVersion}\";\r\n		notification.message = $operationWrapper.operation.toMessage();\r\n		$operationWrapper.operation.message = $operationWrapper.operation.toMessage();\r\n		//\r\n		// Ok, let\'s figure out what APP-C\'s response is\r\n		//\r\n		switch (code) {\r\n			case ACCEPT:\r\n				$operationWrapper.operation.outcome = \"PROCESSING\";\r\n				break;\r\n			case ERROR:\r\n			case REJECT:\r\n				$operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\r\n				$manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\r\n				break;\r\n			case SUCCESS:\r\n				$operationWrapper.operation.outcome = \"SUCCESS\";\r\n				$manager.setControlLoopResult(\"SUCCESS\");\r\n				break;\r\n			case FAILURE:\r\n				$operationWrapper.operation.outcome = \"FAILURE\";\r\n				$manager.setControlLoopResult(\"FAILURE\");\r\n				break;\r\n		}\r\n		if ($operationWrapper.operation.outcome.equals(\"SUCCESS\")) {\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n            notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n\r\n			//\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		} else if ($operationWrapper.operation.outcome.equals(\"PROCESSING\")) {\r\n			retract($response);\r\n		} else {\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n            notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n			//\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		}\r\n		\r\nend		\r\n\r\n/*\r\n*\r\n* This rule is used to clean up APPC response\r\n*\r\n*/		\r\nrule \"${policyName}.APPC.RESPONSE.CLEANUP\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\r\n        $response : Response($id : getCommonHeader().RequestID )\r\n		not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) ) \r\n	then\r\n		System.out.println(\"rule APPC.RESPONSE.CLEANUP is triggered.\");\r\n		retract($response);\r\nend\r\n\r\n/*\r\n*\r\n* This rule responds to MSO Response Events\r\n*\r\n*/\r\nrule \"${policyName}.MSO.RESPONSE\"\r\n	when\r\n		$params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\r\n		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\r\n		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\r\n		$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\r\n		$request : MSORequest( requestId == $event.requestID.toString() )\r\n		$response : MSOResponse( request.requestId == $event.requestID.toString() )	\r\n	then\r\n		System.out.println(\"rule MSO.RESPONSE is triggered.\");\r\n		//\r\n		// Construct notification\r\n		//\r\n		VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\r\n		notification.from = \"policy\";\r\n		notification.policyName = drools.getRule().getName();\r\n		notification.policyScope = \"${policyScope}\";\r\n		notification.policyVersion = \"${policyVersion}\";\r\n		notification.message = $operationWrapper.operation.toMessage();\r\n		$operationWrapper.operation.message = $operationWrapper.operation.toMessage();\r\n		//\r\n		// The operation can either be succeeded or failed\r\n		// \r\n		if($response.request.requestStatus.requestState.equals(\"Completed\")) {\r\n			$operationWrapper.operation.outcome = \"SUCCESS\";\r\n			$manager.setControlLoopResult(\"SUCCESS\");\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n			notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n            //\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		} else {\r\n			$operationWrapper.operation.outcome = \"FAILURE\";\r\n			$manager.setControlLoopResult(\"FAILURE\");\r\n			notification.history.add($operationWrapper.operation);\r\n			notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\r\n			//\r\n			// Let interested parties know\r\n			//\r\n			try {\r\n				System.out.println(Serialization.gsonPretty.toJson(notification));\r\n				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n			} catch (Exception e) {\r\n				System.out.println(\"Can\'t deliver notification: \" + notification);\r\n				e.printStackTrace();\r\n			}\r\n			notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\r\n            //\r\n            // Let interested parties know\r\n            //\r\n            try {\r\n            	System.out.println(Serialization.gsonPretty.toJson(notification));\r\n            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\r\n            } catch (Exception e) {\r\n            	System.out.println(\"Can\'t deliver notification: \" + notification);\r\n            	e.printStackTrace();\r\n            }\r\n            //\r\n			// We are going to retract these objects from memory\r\n			//\r\n			System.out.println(\"Retracting everything\");\r\n			retract($operationWrapper);\r\n			retract($request);\r\n			retract($response);\r\n			retract($event);\r\n			retract($manager);\r\n		}\r\n		\r\nend	','2017-02-09 17:11:42','demo');

insert into sequence (seq_name, seq_count) values ('SEQ_GEN', 3050); 

set foreign_key_checks=1; 
commit; 
