Download presentation
Presentation is loading. Please wait.
Published byEdmund Preston Modified over 9 years ago
1
Pizza Party Application Sample and Regression Test An Overview
2
The Pizza Party This application (COUGAAR_INSTALL_PATH/pizza) is a good introduction to Cougaar features, and helps ensure all features are working in new releases. It shows Plugins, Tasks and Allocations, Assets, Property Groups, Relays, Communities, ABAs, Yellow Pages, Service Discovery, Servlets, Alarms, …
3
The Story Alice is throwing a pizza party She invites the friends on her FriendsOfMark buddy list They are Carnivores or Vegetarians, and tell her the kind of pizza they want After waiting for RSVPs, she wants to order the pizza She then does Service Discovery, to look in the Yellow Pages for PizzaProviders –In the non-SD version, she has a single relationship with Joes She finds a provider (Joes), and sends a 2-party order –Meat and Veggie Joes does not sell Veggie pizza, so that part of the order fails –In the non-SD version, Alice has failed – her friends will not be happy! Alice wants to order from just one place, so rescinds the order She goes back to the Yellow Pages, specifying she doesn’t want Joes Having looked in Cambridge, she expands her search to the overall MA Yellow Pages, and finds Dominos. Alice re-sends her order to Dominos Dominos is happy to sell her the pizza The party is on!
4
The Configuration Files…
5
Nodes and Agents MA Joe’s TonyMark SDPizzaNode2 Alice Cambridge Dominos Bob SDPizzaNode1 There is one “society.xml” file per Node. See pizza/configs/pizzaparty for SDPizzaNode1 and SDPizzaNode2.xml
6
Pizza Communities Alice MA Joe’sTonyMark Cambridge DominosBob MA YP Community Friends of Mark Community YP Server, Comm Manager Pizza Provider Cambridge YP Community Comm Manager, Pizza Client Defined in communities.xml
7
Other Configuration Data The 2 Node’s list a bunch of VM parameters (-D arguments) –Where the White Pages will run –COUGAAR_INSTALL_PATH –Log Service Config file LDMDomains.ini lists Domains –We user Pizza and ServiceDiscovery
8
Society Startup Sequence
9
Community Initialization MA Joe’s Tony Mark Alice Cambridge DominosBob Comm Join Comm Join (whole community) Comm Join CommunityPlugin does the work
10
Service Discovery Initialization MA Joe’s Cambridge Dominos Register as PizzaProvider Publish Taxonomy See the SDRegistrationPlugin and PublishTaxonomy plugins (Additionally, each Agent’s AssetDataParamPlugin creates a local self Entity Asset)
11
Entity Asset Creation Joe’s Tony Mark AliceDominosBob AssetDataParamPlugin creates a local self Entity Asset, representing the local Person or Store. It is used for Relationships (like PizzaProvider), and tells people the kind of pizza they like (Meat or Veggie). Store - Dominos Person – Alice Vegetarian Store - Joes Person – Mark Vegetarian Person – Tony Carnivore Person – Bob Carnivore
12
Prototype Registration Joe’s DominosAlice PizzaPrototypePI KitchenPrototypePI Register the Store’s Kitchen, with a PropertyGroup indicating the kind of Pizza they make Register a prototype Pizza Asset, for use as the DirectObject on the Order Task
13
Now the Application Run Flow
14
Step 1: Invite to Party MA Joe’s Tony Mark Alice Cambridge DominosBob InvitePI Publish Invitation Relay with ABA target “FriendsOfMark” Invitation Alice gets own invite ABA Expanded, Relay sent to all Targets
15
Step 2: Find Food Preference MA Joe’s Tony Mark Alice Cambridge DominosBob Invitation Self: Meat or Veggie PG? RSVPPI RSVP Plugin checks self Entity’s PGs and puts Response on Relay of Meat or Veggie Preference
16
Step 3: Collect Incoming Replies MA Joe’s Tony Mark Alice Cambridge DominosBob Invitation Relay responses when published are auto sent back to Alice PizzaPreferences: 2 Meat, 2 Veggie Relay Responses Relay Source auto-updates the collected PizzaPreferences
17
Step 4: Publish PizzaPreferences MA Joe’s Tony Mark Alice Cambridge DominosBob Invitation Invite Plugin then publishes a PizzaPreferences object, which the PlaceOrderPI subscribes to InvitePI Pizza Preferences: 2 Meat, 2 Veggie SDPlaceOrderPI
18
Step 5: Create Orders MA Joe’s Tony Mark Alice Cambridge DominosBob Invitation SDPlaceOrder Plugin publishes a Task: “Order Pizza”, and expands that for each kind of Pizza needed SDPlaceOrderPI Task: Order 2 Meat Task: Order 2 Veggie Task: Order Pizza
19
Step 6: Ask for Providers Publish FindProviders with Role Pizza Provider. SDClientPlugin passes an MMQuery to the MatchmakerPlugin. Alice SDPlaceOrderPI Task: FindProviders: PizzaProvider SDClientPIMatchmakerPI MMQuery: PizzaProvider
20
MA Cambridge Dominos Step 7: Query Yellow Pages MatchmakerPlugin asks CommunityService for it’s YP Community. Then it issues a YP Query for a registered PizzaProvider. That query will look in the local YP first. If it can’t find a match, it looks in the next higher YP (parent Community). When an answer comes back, it is scored with the RoleWithBlacklistScorer – if it’s the right Role, without being on the Blacklist, we use it. The answer goes back to the SDClientPlugin Joe’s MatchmakerPI CommunityService YP? Cambridge- YPCommunity Alice PizzaProvider? Joes
21
Step 8: Establish Relationship The SDClientPlugin sends a ServiceContractRelay to the named Provider. The AgreeableProviderPlugin at Joes just says yes, attaching a Contract. The ServiceContractLP sees the Contract, and fills in a Relationship on the local self Entity on each end of the relationship. The SDClientPlugin, having gotten a Contract, Disposes the FindProviders Task as successfully complete. Joe’s Alice SDClientPI AgreeableProviderPI ServiceContract Relay Contract Relationship: Joes/PizzaProvider Relationship: Alice/PizzaConsumer FindProviders: Success Disposition
22
Step 9: Allocate Tasks The SDPlaceOrderPlugin, having finished FindProviders, gets the Provider off it’s Relationship Schedule on the self Entity, and Allocates the 2 Order Tasks to that Entity. The infrastructure sees this Allocation to an Entity, and copies the Task at the other Entity – Joes. Alice SDPlaceOrderPI Relationship: Joes/PizzaProvider FindProviders: Success Disposition Task: Order 2 Meat Task: Order 2 Veggie Joe’s Allocation: Joes
23
Step 10:Match Capabilities Joe’s Alice ProcessOrderPI Task: Order 2 Meat Task: Order 2 Veggie Kitchen - Meat Allocation: PASS Allocation: FAIL At Joes, the ProcessOrderPlugin sees 2 new Order Tasks. It Allocates them to the local Kitchen Asset. It looks at the local Kitchen Asset to match the Meat / Veggie toppings requested on the DirectObject of the Order Task. If its Kitchen has matching capabilities, the Task gets a Success Result, otherwise it says it will deliver 0 pizzas, and gives it a Failure Result. The infrastructure copies those results back to Alice (where the Tasks came from).
24
Step 11: Done? If the Provider (Joes) filled the Orders (he didn’t) Alice would be done. Otherwise, the SDPlaceOrderPlugin rescinds the Allocations (Alice wants to order all pizza from one store), and must issue a new FindProviders Task, asking for a new provider, other than Joes. Now, we repeat steps 6-11. This time, we get Dominos, and the party is on!
25
What Next? Have you read the documentation? (Online at http://tutorials.cougaar.org/pizza ) http://tutorials.cougaar.org/pizza Read through the javadoc (Online at http://cougaar.cougaar.org/software/latest/javadoc/ pizza/doc/api/ ) http://cougaar.cougaar.org/software/latest/javadoc/ pizza/doc/api/ Read through the config files (pizza/configs/pizzaparty – see the Readme) Try modifying the application –Add a friend –Make Joes serve Veggie Pizza
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.