<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Resolving Specifiers
Specifier grammars allow you to specify complex inputs for Batfish questions.
This category of questions reveals how specifier inputs are resolved
by Batfish.
Resolve Location Specifier
Resolve Filter Specifier
Resolve Node Specifier
Resolve Interface Specifier
Resolve IPs from Location Specifier
Resolve IP Specifier
Step1:  Resolve Location Specifier
Returns the set of locations corresponding to a locationSpec value.
Helper question that shows how specified locationSpec values resolve to the locations in the network.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
locations | Input to the LocationSpecifier. | LocationSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
Invocation
Step2:  Return Value
Name | Description | Type
--- | --- | ---
Location | Location | str
Print the first 5 rows of the returned Dataframe
Step3:  Print the first row of the returned Dataframe
Step4:  Resolve Filter Specifier
Returns the set of filters corresponding to a filterSpec value.
Helper question that shows how specified filterSpec values resolve to the filters in the network.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
filters | Input to the FilterSpecifier. | FilterSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
nodes | Input to the NodeSpecifier that specifies the set of nodes that should be considered. | NodeSpec | True | /.*/
Invocation
Step5:  Return Value
Name | Description | Type
--- | --- | ---
Node | Node | str
Filter_Name | Filter name | str
Print the first 5 rows of the returned Dataframe
Step6:  Print the first row of the returned Dataframe
Step7:  Resolve Node Specifier
Returns the set of nodes corresponding to a nodeSpec value.
Helper question that shows how specified nodeSpec values resolve to the nodes in the network.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
nodes | Input to the NodeSpecifier. | NodeSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
Invocation
Step8:  Return Value
Name | Description | Type
--- | --- | ---
Node | Node | str
Print the first 5 rows of the returned Dataframe
Step9:  Print the first row of the returned Dataframe
Step10:  Resolve Interface Specifier
Returns the set of interfaces corresponding to an interfaceSpec value.
Helper question that shows how specified interfaceSpec values resolve to the interfaces in the network.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
interfaces | Input to the interfaceSpecifier. | InterfaceSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
nodes | Input to the NodeSpecifier that specifies the set of nodes that should be considered. | NodeSpec | True | /.*/
Invocation
Step11:  Return Value
Name | Description | Type
--- | --- | ---
Interface | Interface | Interface
Print the first 5 rows of the returned Dataframe
Step12:  Print the first row of the returned Dataframe
Step13:  Resolve IPs from Location Specifier
Returns IPs that are auto-assigned to locations.
Helper question that shows IPs that will be assigned to specified locationSpec values by questions are automatically pick IPs based on locations.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
locations | Input to the LocationSpecifier. | LocationSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
Invocation
Step14:  Return Value
Name | Description | Type
--- | --- | ---
Locations | Resolution | str
IP_Space | IP space | str
Print the first 5 rows of the returned Dataframe
Step15:  Print the first row of the returned Dataframe
Step16:  Resolve IP Specifier
Returns the IP address space corresponding to an ipSpec value.
Helper question that shows how specified ipSpec values resolve to IPs.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
ips | Input to the IP space specifier. | IpSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
Invocation
Step17:  Return Value
Name | Description | Type
--- | --- | ---
IP_Space | IP space | str
Print the first 5 rows of the returned Dataframe
Step18:  Print the first row of the returned Dataframe
<ASSISTANT_TASK:>
Python Code:
bf.set_network('generate_questions')
bf.set_snapshot('generate_questions')
Explanation: Resolving Specifiers
Specifier grammars allow you to specify complex inputs for Batfish questions.
This category of questions reveals how specifier inputs are resolved
by Batfish.
Resolve Location Specifier
Resolve Filter Specifier
Resolve Node Specifier
Resolve Interface Specifier
Resolve IPs from Location Specifier
Resolve IP Specifier
End of explanation
result = bf.q.resolveLocationSpecifier(locations='@enter(as2border1[GigabitEthernet2/0])').answer().frame()
Explanation: Resolve Location Specifier
Returns the set of locations corresponding to a locationSpec value.
Helper question that shows how specified locationSpec values resolve to the locations in the network.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
locations | Input to the LocationSpecifier. | LocationSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
Invocation
End of explanation
result.head(5)
Explanation: Return Value
Name | Description | Type
--- | --- | ---
Location | Location | str
Print the first 5 rows of the returned Dataframe
End of explanation
result.iloc[0]
bf.set_network('generate_questions')
bf.set_snapshot('generate_questions')
Explanation: Print the first row of the returned Dataframe
End of explanation
result = bf.q.resolveFilterSpecifier(filters='@in(as2border1[GigabitEthernet0/0])').answer().frame()
Explanation: Resolve Filter Specifier
Returns the set of filters corresponding to a filterSpec value.
Helper question that shows how specified filterSpec values resolve to the filters in the network.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
filters | Input to the FilterSpecifier. | FilterSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
nodes | Input to the NodeSpecifier that specifies the set of nodes that should be considered. | NodeSpec | True | /.*/
Invocation
End of explanation
result.head(5)
Explanation: Return Value
Name | Description | Type
--- | --- | ---
Node | Node | str
Filter_Name | Filter name | str
Print the first 5 rows of the returned Dataframe
End of explanation
result.iloc[0]
bf.set_network('generate_questions')
bf.set_snapshot('generate_questions')
Explanation: Print the first row of the returned Dataframe
End of explanation
result = bf.q.resolveNodeSpecifier(nodes='/border/').answer().frame()
Explanation: Resolve Node Specifier
Returns the set of nodes corresponding to a nodeSpec value.
Helper question that shows how specified nodeSpec values resolve to the nodes in the network.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
nodes | Input to the NodeSpecifier. | NodeSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
Invocation
End of explanation
result.head(5)
Explanation: Return Value
Name | Description | Type
--- | --- | ---
Node | Node | str
Print the first 5 rows of the returned Dataframe
End of explanation
result.iloc[0]
bf.set_network('generate_questions')
bf.set_snapshot('generate_questions')
Explanation: Print the first row of the returned Dataframe
End of explanation
result = bf.q.resolveInterfaceSpecifier(interfaces='/border/[.*Ethernet]').answer().frame()
Explanation: Resolve Interface Specifier
Returns the set of interfaces corresponding to an interfaceSpec value.
Helper question that shows how specified interfaceSpec values resolve to the interfaces in the network.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
interfaces | Input to the interfaceSpecifier. | InterfaceSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
nodes | Input to the NodeSpecifier that specifies the set of nodes that should be considered. | NodeSpec | True | /.*/
Invocation
End of explanation
result.head(5)
Explanation: Return Value
Name | Description | Type
--- | --- | ---
Interface | Interface | Interface
Print the first 5 rows of the returned Dataframe
End of explanation
result.iloc[0]
bf.set_network('generate_questions')
bf.set_snapshot('generate_questions')
Explanation: Print the first row of the returned Dataframe
End of explanation
result = bf.q.resolveIpsOfLocationSpecifier(locations='@enter(as2border1[GigabitEthernet2/0])').answer().frame()
Explanation: Resolve IPs from Location Specifier
Returns IPs that are auto-assigned to locations.
Helper question that shows IPs that will be assigned to specified locationSpec values by questions are automatically pick IPs based on locations.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
locations | Input to the LocationSpecifier. | LocationSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
Invocation
End of explanation
result.head(5)
Explanation: Return Value
Name | Description | Type
--- | --- | ---
Locations | Resolution | str
IP_Space | IP space | str
Print the first 5 rows of the returned Dataframe
End of explanation
result.iloc[0]
bf.set_network('generate_questions')
bf.set_snapshot('generate_questions')
Explanation: Print the first row of the returned Dataframe
End of explanation
result = bf.q.resolveIpSpecifier(ips='/border/[.*Ethernet]').answer().frame()
Explanation: Resolve IP Specifier
Returns the IP address space corresponding to an ipSpec value.
Helper question that shows how specified ipSpec values resolve to IPs.
Inputs
Name | Description | Type | Optional | Default Value
--- | --- | --- | --- | --- 
ips | Input to the IP space specifier. | IpSpec | False | 
grammarVersion | Version of grammar to use for resolution. | str | True | 
Invocation
End of explanation
result.head(5)
Explanation: Return Value
Name | Description | Type
--- | --- | ---
IP_Space | IP space | str
Print the first 5 rows of the returned Dataframe
End of explanation
result.iloc[0]
Explanation: Print the first row of the returned Dataframe
End of explanation
<END_TASK>